summaryrefslogtreecommitdiff
path: root/app/helpers/todos_helper.rb
diff options
context:
space:
mode:
authorJarka Kadlecova <jarka@gitlab.com>2017-03-20 09:20:46 +0100
committerJarka Kadlecova <jarka@gitlab.com>2017-03-20 12:45:43 +0100
commitbf41a2e7525cc952686623b508023c169dbdfe2d (patch)
tree54c40265696352d6972989dddd21d46f7c6ed9ae /app/helpers/todos_helper.rb
parent691402fb2b361ba19db3b8bdf77b75e513883423 (diff)
downloadgitlab-ce-bf41a2e7525cc952686623b508023c169dbdfe2d.tar.gz
Todos performance: Include associations in Finder
Diffstat (limited to 'app/helpers/todos_helper.rb')
-rw-r--r--app/helpers/todos_helper.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 4f5adf623f2..847a8fdfca6 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -39,9 +39,13 @@ module TodosHelper
namespace_project_commit_path(todo.project.namespace.becomes(Namespace), todo.project,
todo.target, anchor: anchor)
else
- path = [todo.project.namespace.becomes(Namespace), todo.project, todo.target]
-
- path.unshift(:pipelines) if todo.build_failed?
+ if todo.build_failed?
+ # associated namespace and route would be loaded from the db again if todo.project was used
+ project = todo.target.project
+ path = [:pipelines, project.namespace.becomes(Namespace), project, todo.target]
+ else
+ path = [todo.target]
+ end
polymorphic_path(path, anchor: anchor)
end