summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-08-09 15:57:52 -0700
committerStan Hu <stanhu@gmail.com>2017-08-09 15:57:52 -0700
commit09baadca349670822645b56a17e9bf8716e997b6 (patch)
tree397bb26f3a0e851b39c57351cbe6963adc47dea8 /app/finders
parentded77e21b38dbb65aec2aeae42de02e6571fe01a (diff)
parent2925850ceec3ef89eb1f60b0a648dbc5f72d8683 (diff)
downloadgitlab-ce-09baadca349670822645b56a17e9bf8716e997b6.tar.gz
Merge branch 'master' into sh-headless-chrome-support
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/todos_finder.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb
index 3fe37c75381..b276116f0c6 100644
--- a/app/finders/todos_finder.rb
+++ b/app/finders/todos_finder.rb
@@ -95,9 +95,18 @@ class TodosFinder
@project
end
+ def project_ids(items)
+ ids = items.except(:order).select(:project_id)
+ if Gitlab::Database.mysql?
+ # To make UPDATE work on MySQL, wrap it in a SELECT with an alias
+ ids = Todo.except(:order).select('*').from("(#{ids.to_sql}) AS t")
+ end
+
+ ids
+ end
+
def projects(items)
- item_project_ids = items.reorder(nil).select(:project_id)
- ProjectsFinder.new(current_user: current_user, project_ids_relation: item_project_ids).execute
+ ProjectsFinder.new(current_user: current_user, project_ids_relation: project_ids(items)).execute
end
def type?