@@ -187,7 +187,7 class Query < ActiveRecord::Base | |||
|
187 | 187 | if project |
|
188 | 188 | user_values += project.users.sort.collect{|s| [s.name, s.id.to_s] } |
|
189 | 189 | else |
|
190 |
project_ids = User.current |
|
|
190 | project_ids = Project.all(:conditions => Project.visible_by(User.current)).collect(&:id) | |
|
191 | 191 | if project_ids.any? |
|
192 | 192 | # members of the user's projects |
|
193 | 193 | 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] } |
@@ -351,4 +351,13 class QueryTest < ActiveSupport::TestCase | |||
|
351 | 351 | assert !q.editable_by?(manager) |
|
352 | 352 | assert !q.editable_by?(developer) |
|
353 | 353 | end |
|
354 | ||
|
355 | context "#available_filters" do | |
|
356 | should "include users of visible projects in cross-project view" do | |
|
357 | query = Query.new(:name => "_") | |
|
358 | users = query.available_filters["assigned_to_id"] | |
|
359 | assert_not_nil users | |
|
360 | assert users[:values].map{|u|u[1]}.include?("3") | |
|
361 | end | |
|
362 | end | |
|
354 | 363 | end |
General Comments 0
You need to be logged in to leave comments.
Login now