summaryrefslogtreecommitdiff
path: root/app/models/concerns/noteable.rb
diff options
context:
space:
mode:
authorMarkus Koller <mkoller@gitlab.com>2019-09-02 13:12:20 +0200
committerMarkus Koller <mkoller@gitlab.com>2019-09-10 15:24:28 +0200
commit60755fbc406bd25ab526339899f97a2b27aeb272 (patch)
treea60f6fa9beb0c4ccdc27c5f7734c14bc34ad2d21 /app/models/concerns/noteable.rb
parent08b0613302ec813c0735e2c0447a3f7683d7ab87 (diff)
downloadgitlab-ce-60755fbc406bd25ab526339899f97a2b27aeb272.tar.gz
Optimize queries for snippet listings
- Avoid N+1 queries for authors and comment counts - Avoid an additional snippet existence query
Diffstat (limited to 'app/models/concerns/noteable.rb')
-rw-r--r--app/models/concerns/noteable.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/concerns/noteable.rb b/app/models/concerns/noteable.rb
index 6a44bc7c401..b3e4df730b4 100644
--- a/app/models/concerns/noteable.rb
+++ b/app/models/concerns/noteable.rb
@@ -3,6 +3,10 @@
module Noteable
extend ActiveSupport::Concern
+ # This object is used to gather noteable meta data for list displays
+ # avoiding n+1 queries and improving performance.
+ NoteableMeta = Struct.new(:user_notes_count)
+
class_methods do
# `Noteable` class names that support replying to individual notes.
def replyable_types