]> source.dussan.org Git - redmine.git/commitdiff
Prevents invalid SQL with invalid group_ids (#14902).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 25 Sep 2013 17:35:59 +0000 (17:35 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 25 Sep 2013 17:35:59 +0000 (17:35 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12162 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/issue.rb

index e6851e4fb568c0be0a1a05f30a53d7ad54233a3f..42d33be09d216b8e49d1ddad3f10e4e582ca3aa9 100644 (file)
@@ -108,10 +108,10 @@ class Issue < ActiveRecord::Base
         when 'all'
           nil
         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(',')}))"
         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(',')}))"
         else
           '1=0'