diff options
author | Rémy Coutable <remy@rymai.me> | 2017-03-21 17:31:56 +0000 |
---|---|---|
committer | DJ Mountney <david@twkie.net> | 2017-03-21 10:40:28 -0700 |
commit | c0d47ad566a40f486a82429c96be1126a6e02454 (patch) | |
tree | 02a4c72a33cc9ef7d740fa017df12ccbc4a4fbc8 /app | |
parent | f01352f1d8224d00e07e7e70ec43590db80a5667 (diff) | |
download | gitlab-ce-c0d47ad566a40f486a82429c96be1126a6e02454.tar.gz |
Merge branch 'revert-37328406' into 'master'
Revert "Merge branch '29534-todos-performance' into 'master'"
Closes #29758
See merge request !10116
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 2 | ||||
-rw-r--r-- | app/finders/todos_finder.rb | 12 | ||||
-rw-r--r-- | app/helpers/todos_helper.rb | 10 | ||||
-rw-r--r-- | app/models/merge_request.rb | 5 |
4 files changed, 8 insertions, 21 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 00576272b62..5848ca62777 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -45,7 +45,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController private def find_todos - @todos ||= TodosFinder.new(current_user, params.merge(include_associations: true)).execute + @todos ||= TodosFinder.new(current_user, params).execute end def todos_counts diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb index 13d33a1c31b..b7f091f334d 100644 --- a/app/finders/todos_finder.rb +++ b/app/finders/todos_finder.rb @@ -24,7 +24,6 @@ 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) @@ -39,17 +38,6 @@ 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 diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 847a8fdfca6..4f5adf623f2 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -39,13 +39,9 @@ module TodosHelper namespace_project_commit_path(todo.project.namespace.becomes(Namespace), todo.project, todo.target, anchor: anchor) else - 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 + path = [todo.project.namespace.becomes(Namespace), todo.project, todo.target] + + path.unshift(:pipelines) if todo.build_failed? polymorphic_path(path, anchor: anchor) end diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index d782f7847d7..0f7b8311588 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -7,7 +7,6 @@ class MergeRequest < ActiveRecord::Base belongs_to :target_project, class_name: "Project" belongs_to :source_project, class_name: "Project" - belongs_to :project, foreign_key: :target_project_id belongs_to :merge_user, class_name: "User" has_many :merge_request_diffs, dependent: :destroy @@ -538,6 +537,10 @@ class MergeRequest < ActiveRecord::Base target_project != source_project end + def project + target_project + end + # If the merge request closes any issues, save this information in the # `MergeRequestsClosingIssues` model. This is a performance optimization. # Calculating this information for a number of merge requests requires |