diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-11-21 17:49:07 +0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2017-11-23 04:27:33 +0300 |
commit | b79f22c72b2c97bca50be2e4c7770c16fabb103d (patch) | |
tree | 5235fbac12cc20820f21cc9980ad2daa753321f1 /lib | |
parent | eb2643f2a9eb71c0f463bc8c7ee63358fdbfd6c3 (diff) |
Merge branch '39461-notes-api-for-issues-no-longer-returns-label-additions-removals' into 'master'
Resolve "Notes API for issues no longer returns label additions/removals"
Closes #39461
See merge request gitlab-org/gitlab-ce!15080
(cherry picked from commit f562e69eab0d7bac8ea20d29c3df981289dd8cdb)
4374a38f fix the commit reference pattern from matching other entities
160324d0 try to fix the failing spec on external refs
71b2cc1d reverting to the simpler approach
869fc05d fix the linting error
9ed91479 add the missing spec
c900c21e add `#with_metadata` scope to remove a N+1 from the notes' API
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/notes.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 0b9ab4eeb05..ceaaeca4046 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -33,7 +33,7 @@ module API # paginate() only works with a relation. This could lead to a # mismatch between the pagination headers info and the actual notes # array returned, but this is really a edge-case. - paginate(noteable.notes) + paginate(noteable.notes.with_metadata) .reject { |n| n.cross_reference_not_visible_for?(current_user) } present notes, with: Entities::Note else @@ -50,7 +50,7 @@ module API end get ":id/#{noteables_str}/:noteable_id/notes/:note_id" do noteable = find_project_noteable(noteables_str, params[:noteable_id]) - note = noteable.notes.find(params[:note_id]) + note = noteable.notes.with_metadata.find(params[:note_id]) can_read_note = can?(current_user, noteable_read_ability_name(noteable), noteable) && !note.cross_reference_not_visible_for?(current_user) if can_read_note |