From 62b66e9b38a8e6a1e60cb0aa8200145ce5f62666 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 25 Sep 2013 17:35:59 +0000 Subject: [PATCH] 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 --- app/models/issue.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index e6851e4fb..42d33be09 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -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' -- 2.39.5