summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorDJ Mountney <david@twkie.net>2016-05-25 21:31:36 -0700
committerDJ Mountney <david@twkie.net>2016-06-02 11:24:18 -0700
commit4ecc10fade61a1b45cd45ea4189e95a2acbea353 (patch)
tree2856d39afae04ac46fc2478336005decd1415ac9 /app/finders
parentc3e923c496b7d1c344a5fa68cef4a80ce23c90d0 (diff)
downloadgitlab-ce-4ecc10fade61a1b45cd45ea4189e95a2acbea353.tar.gz
Reduce the filters on the todos joins project query by being explicit about the join
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/todos_finder.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb
index f638b5bf91f..3243d62fc95 100644
--- a/app/finders/todos_finder.rb
+++ b/app/finders/todos_finder.rb
@@ -23,7 +23,13 @@ class TodosFinder
end
def execute
- items = current_user.todos.joins(:project).where(projects: { pending_delete: false })
+ items = current_user.todos
+
+ # Filter out todos linked to project pending deletion
+ items = items.joins(
+ 'INNER JOIN projects ON projects.id = todos.project_id AND projects.pending_delete = false'
+ )
+
items = by_action_id(items)
items = by_author(items)
items = by_project(items)