]> source.dussan.org Git - redmine.git/commitdiff
Merged r3916 from trunk.
authorEric Davis <edavis@littlestreamsoftware.com>
Thu, 19 Aug 2010 04:31:18 +0000 (04:31 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Thu, 19 Aug 2010 04:31:18 +0000 (04:31 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@3966 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/unit/query_test.rb

index f697a721df6f65032493a4b32db157f77fcd0f08..fd7aa3477bb17d0f1253540b0ff8af9244e30a24 100644 (file)
@@ -187,7 +187,7 @@ class Query < ActiveRecord::Base
     if project
       user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] }
     else
-      project_ids = User.current.projects.collect(&:id)
+      project_ids = Project.all(:conditions => Project.visible_by(User.current)).collect(&:id)
       if project_ids.any?
         # members of the user's projects
         user_values += User.active.find(:all, :conditions => ["#{User.table_name}.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (?))", project_ids]).sort.collect{|s| [s.name, s.id.to_s] }
index 26cba2a5ec27619459c36fea681feeee8240cdaa..4b11830e8f5989069f91a5197e9654c546cecfbd 100644 (file)
@@ -351,4 +351,13 @@ class QueryTest < ActiveSupport::TestCase
     assert !q.editable_by?(manager)
     assert !q.editable_by?(developer)
   end
+
+  context "#available_filters" do
+    should "include users of visible projects in cross-project view" do
+      query = Query.new(:name => "_")
+      users = query.available_filters["assigned_to_id"]
+      assert_not_nil users
+      assert users[:values].map{|u|u[1]}.include?("3")
+    end
+  end
 end