summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorFelipe Artur <felipefac@gmail.com>2017-01-23 18:40:25 -0200
committerFelipe Artur <felipefac@gmail.com>2017-02-09 17:40:37 -0200
commit0b14b654b6e5d936f7241dcc0c249e0d4cc42728 (patch)
tree714fff562236a7cbc78d837cea8ff7a648923166 /app/models/concerns
parentc4fd6ff407cff8f2f742997a7400ba940a1fce5f (diff)
downloadgitlab-ce-0b14b654b6e5d936f7241dcc0c249e0d4cc42728.tar.gz
Gather issuable metadata to avoid n+ queries on index viewissue_25900_2
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/issuable.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index 3517969eabc..bfb54e878fc 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -15,6 +15,11 @@ module Issuable
include Taskable
include TimeTrackable
+ # This object is used to gather issuable meta data for displaying
+ # upvotes, downvotes and notes count for issues and merge requests
+ # lists avoiding n+1 queries and improving performance.
+ IssuableMeta = Struct.new(:upvotes, :downvotes, :notes_count)
+
included do
cache_markdown_field :title, pipeline: :single_line
cache_markdown_field :description