Prevents invalid SQL with invalid group_ids (#14902).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12162 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-09-25 17:35:59 +00:00
parent 3ace406bba
commit 62b66e9b38
1 changed files with 2 additions and 2 deletions

View File

@ -108,10 +108,10 @@ class Issue < ActiveRecord::Base
when 'all' when 'all'
nil nil
when 'default' when 'default'
user_ids = [user.id] + user.groups.map(&:id) user_ids = [user.id] + user.groups.map(&:id).compact
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" "(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
when 'own' when 'own'
user_ids = [user.id] + user.groups.map(&:id) user_ids = [user.id] + user.groups.map(&:id).compact
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))" "(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
else else
'1=0' '1=0'