summaryrefslogtreecommitdiff
path: root/app/finders/todos_finder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/todos_finder.rb')
-rw-r--r--app/finders/todos_finder.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb
index b7f091f334d..13d33a1c31b 100644
--- a/app/finders/todos_finder.rb
+++ b/app/finders/todos_finder.rb
@@ -24,6 +24,7 @@ class TodosFinder
def execute
items = current_user.todos
+ items = include_associations(items)
items = by_action_id(items)
items = by_action(items)
items = by_author(items)
@@ -38,6 +39,17 @@ class TodosFinder
private
+ def include_associations(items)
+ return items unless params[:include_associations]
+
+ items.includes(
+ [
+ target: { project: [:route, namespace: :route] },
+ author: { namespace: :route },
+ ]
+ )
+ end
+
def action_id?
action_id.present? && Todo::ACTION_NAMES.has_key?(action_id.to_i)
end