summaryrefslogtreecommitdiff
path: root/app/models/note.rb
diff options
context:
space:
mode:
authorLuke Duncalfe <lduncalfe@eml.cc>2019-07-04 15:33:14 +1200
committerLuke Duncalfe <lduncalfe@eml.cc>2019-07-10 12:13:48 +1200
commit073c8b25ea36b6b96eab05eb675e8726b1d5318e (patch)
tree5f83a17cf6e461106d8ddf8f1b84f743a09547d6 /app/models/note.rb
parent254f78f5dc36d4aef26d1ab2a924e4fa916221c6 (diff)
downloadgitlab-ce-073c8b25ea36b6b96eab05eb675e8726b1d5318e.tar.gz
GraphQL support for Notes created in discussions62826-graphql-note-mutations
A new `discussion_id` argument on the `createNote` mutation allows people to create a note within that discussion. The ability to lazy-load Discussions has been added, so GraphQL.object_from_id can treat Discussions the same as AR objects and batch load them. https://gitlab.com/gitlab-org/gitlab-ce/issues/62826 https://gitlab.com/gitlab-org/gitlab-ee/issues/9489
Diffstat (limited to 'app/models/note.rb')
-rw-r--r--app/models/note.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/note.rb b/app/models/note.rb
index 4e9ea146485..5c31cff9816 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -158,6 +158,8 @@ class Note < ApplicationRecord
Discussion.build_collection(all.includes(:noteable).fresh, context_noteable)
end
+ # Note: Where possible consider using Discussion#lazy_find to return
+ # Discussions in order to benefit from having records batch loaded.
def find_discussion(discussion_id)
notes = where(discussion_id: discussion_id).fresh.to_a