diff options
author | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-02-26 20:59:26 +0300 |
---|---|---|
committer | Heinrich Lee Yu <heinrich@gitlab.com> | 2019-02-26 20:59:26 +0300 |
commit | f4be2d4e1bd4ac456610c72862f20ff29b3820a8 (patch) | |
tree | 3c581fe26b071b2b3084daed9ae46597b01ac701 /app | |
parent | f5201a816f2eff9393e16f362403451e5d86ee6c (diff) |
Revert "Merge branch '56726-fix-n+1-in-issues-and-merge-requests-api' into 'master'"
This reverts merge request !25042
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/issuable.rb | 6 | ||||
-rw-r--r-- | app/models/issue.rb | 4 | ||||
-rw-r--r-- | app/views/shared/_issuable_meta_data.html.haml | 2 |
3 files changed, 4 insertions, 8 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 670103bc3f3..429a63f83cc 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -28,7 +28,7 @@ module Issuable # This object is used to gather issuable meta data for displaying # upvotes, downvotes, notes and closing merge requests count for issues and merge requests # lists avoiding n+1 queries and improving performance. - IssuableMeta = Struct.new(:upvotes, :downvotes, :user_notes_count, :merge_requests_count) + IssuableMeta = Struct.new(:upvotes, :downvotes, :notes_count, :merge_requests_count) included do cache_markdown_field :title, pipeline: :single_line @@ -36,8 +36,8 @@ module Issuable redact_field :description - belongs_to :author, class_name: 'User' - belongs_to :updated_by, class_name: 'User' + belongs_to :author, class_name: "User" + belongs_to :updated_by, class_name: "User" belongs_to :last_edited_by, class_name: 'User' belongs_to :milestone diff --git a/app/models/issue.rb b/app/models/issue.rb index 071ad50fddc..0b46e949052 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -263,10 +263,6 @@ class Issue < ActiveRecord::Base end # rubocop: enable CodeReuse/ServiceClass - def merge_requests_count - merge_requests_closing_issues.count - end - private def ensure_metrics diff --git a/app/views/shared/_issuable_meta_data.html.haml b/app/views/shared/_issuable_meta_data.html.haml index 31a5370a5f8..6cc8c485666 100644 --- a/app/views/shared/_issuable_meta_data.html.haml +++ b/app/views/shared/_issuable_meta_data.html.haml @@ -1,4 +1,4 @@ -- note_count = @issuable_meta_data[issuable.id].user_notes_count +- note_count = @issuable_meta_data[issuable.id].notes_count - issue_votes = @issuable_meta_data[issuable.id] - upvotes, downvotes = issue_votes.upvotes, issue_votes.downvotes - issuable_url = @collection_type == "Issue" ? issue_path(issuable, anchor: 'notes') : merge_request_path(issuable, anchor: 'notes') |