diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-20 09:20:46 +0100 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-03-20 12:45:43 +0100 |
commit | bf41a2e7525cc952686623b508023c169dbdfe2d (patch) | |
tree | 54c40265696352d6972989dddd21d46f7c6ed9ae /app/helpers | |
parent | 691402fb2b361ba19db3b8bdf77b75e513883423 (diff) | |
download | gitlab-ce-bf41a2e7525cc952686623b508023c169dbdfe2d.tar.gz |
Todos performance: Include associations in Finder
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/todos_helper.rb | 10 |
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 |