summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorJarka Kadlecová <jarka@gitlab.com>2018-08-06 11:05:44 +0200
committerJarka Kadlecová <jarka@gitlab.com>2018-08-06 14:18:21 +0200
commit6dc7490789237a84b66baaaf4c6deea5ec3bf2de (patch)
tree0753dac4c896896eeae88a3aa0f92de433839e9f /app/finders
parent02b077925dedca390be3e8c4c7960d89ea8d4c6e (diff)
downloadgitlab-ce-6dc7490789237a84b66baaaf4c6deea5ec3bf2de.tar.gz
Add changes from the EE
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/todos_finder.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb
index c505a5cc8d5..6e9c8ea6fde 100644
--- a/app/finders/todos_finder.rb
+++ b/app/finders/todos_finder.rb
@@ -155,11 +155,11 @@ class TodosFinder
def by_group(items)
if group?
groups = group.self_and_descendants
- items = items.where(
- 'project_id IN (?) OR group_id IN (?)',
- Project.where(group: groups).select(:id),
- groups.select(:id)
- )
+ project_todos = items.where(project_id: Project.where(group: groups).select(:id))
+ group_todos = items.where(group_id: groups.select(:id))
+
+ union = Gitlab::SQL::Union.new([project_todos, group_todos])
+ items = Todo.from("(#{union.to_sql}) #{Todo.table_name}")
end
items