Fixe that filter "Assignee's group" doesn't work with group assignments (#13006).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11285 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-01-29 17:59:20 +00:00
parent 5851f55eeb
commit 1e0a94de84
2 changed files with 4 additions and 3 deletions

View File

@ -352,6 +352,7 @@ class IssueQuery < Query
members_of_groups = groups.inject([]) {|user_ids, group| members_of_groups = groups.inject([]) {|user_ids, group|
if group && group.user_ids.present? if group && group.user_ids.present?
user_ids << group.user_ids user_ids << group.user_ids
user_ids << group.id
end end
user_ids.flatten.uniq.compact user_ids.flatten.uniq.compact
}.sort.collect(&:to_s) }.sort.collect(&:to_s)

View File

@ -1124,7 +1124,7 @@ class QueryTest < ActiveSupport::TestCase
@query = IssueQuery.new(:name => '_') @query = IssueQuery.new(:name => '_')
@query.add_filter('member_of_group', '=', [@group.id.to_s]) @query.add_filter('member_of_group', '=', [@group.id.to_s])
assert_query_statement_includes @query, "#{Issue.table_name}.assigned_to_id IN ('#{@user_in_group.id}','#{@second_user_in_group.id}')" assert_query_statement_includes @query, "#{Issue.table_name}.assigned_to_id IN ('#{@user_in_group.id}','#{@second_user_in_group.id}','#{@group.id}')"
assert_find_issues_with_query_is_successful @query assert_find_issues_with_query_is_successful @query
end end
@ -1133,7 +1133,7 @@ class QueryTest < ActiveSupport::TestCase
@query.add_filter('member_of_group', '!*', ['']) @query.add_filter('member_of_group', '!*', [''])
# Users not in a group # Users not in a group
assert_query_statement_includes @query, "#{Issue.table_name}.assigned_to_id IS NULL OR #{Issue.table_name}.assigned_to_id NOT IN ('#{@user_in_group.id}','#{@second_user_in_group.id}','#{@user_in_group2.id}')" assert_query_statement_includes @query, "#{Issue.table_name}.assigned_to_id IS NULL OR #{Issue.table_name}.assigned_to_id NOT IN ('#{@user_in_group.id}','#{@second_user_in_group.id}','#{@user_in_group2.id}','#{@group.id}','#{@group2.id}')"
assert_find_issues_with_query_is_successful @query assert_find_issues_with_query_is_successful @query
end end
@ -1142,7 +1142,7 @@ class QueryTest < ActiveSupport::TestCase
@query.add_filter('member_of_group', '*', ['']) @query.add_filter('member_of_group', '*', [''])
# Only users in a group # Only users in a group
assert_query_statement_includes @query, "#{Issue.table_name}.assigned_to_id IN ('#{@user_in_group.id}','#{@second_user_in_group.id}','#{@user_in_group2.id}')" assert_query_statement_includes @query, "#{Issue.table_name}.assigned_to_id IN ('#{@user_in_group.id}','#{@second_user_in_group.id}','#{@user_in_group2.id}','#{@group.id}','#{@group2.id}')"
assert_find_issues_with_query_is_successful @query assert_find_issues_with_query_is_successful @query
end end