diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e908388..ec22e22 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -320,13 +320,9 @@ class ProjectsController < ApplicationController @issues_by_version = {} unless @selected_tracker_ids.empty? @versions.each do |version| - conditions = {:tracker_id => @selected_tracker_ids} - if !@project.versions.include?(version) - conditions.merge!(:project_id => project_ids) - end issues = version.fixed_issues.visible.find(:all, :include => [:project, :status, :tracker, :priority], - :conditions => conditions, + :conditions => {:tracker_id => @selected_tracker_ids, :project_id => project_ids}, :order => "#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id") @issues_by_version[version] = issues end diff --git a/app/models/project.rb b/app/models/project.rb index b8030d7..58ef811 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -249,7 +249,7 @@ class Project < ActiveRecord::Base return @allowed_parents if @allowed_parents @allowed_parents = Project.find(:all, :conditions => Project.allowed_to_condition(User.current, :add_subprojects)) @allowed_parents = @allowed_parents - self_and_descendants - if User.current.allowed_to?(:add_project, nil, :global => true) + if User.current.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?) @allowed_parents << nil end unless parent.nil? || @allowed_parents.empty? || @allowed_parents.include?(parent) diff --git a/app/models/repository.rb b/app/models/repository.rb index 9f0861b..da1168d 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -159,11 +159,15 @@ class Repository < ActiveRecord::Base end end - # fetch new changesets for all repositories - # can be called periodically by an external script + # Fetches new changesets for all repositories of active projects + # Can be called periodically by an external script # eg. ruby script/runner "Repository.fetch_changesets" def self.fetch_changesets - find(:all).each(&:fetch_changesets) + Project.active.has_module(:repository).find(:all, :include => :repository).each do |project| + if project.repository + project.repository.fetch_changesets + end + end end # scan changeset comments to find related and fixed issues for all repositories diff --git a/app/views/issues/gantt.rhtml b/app/views/issues/gantt.rhtml index ce317ea..8d6677d 100644 --- a/app/views/issues/gantt.rhtml +++ b/app/views/issues/gantt.rhtml @@ -86,7 +86,6 @@ top = headers_height + 8 <%= link_to_issue i %> <% else %> - <%= h("#{i.project} -") unless @project && @project == i.project %> <%= link_to_version i %> <% end %> @@ -211,8 +210,7 @@ top = headers_height + 10 %>