Skip to content
Snippets Groups Projects
Commit c9b4dc67 authored by Patrick Derichs's avatar Patrick Derichs
Browse files

Filter out old system notes for epics

parent 20920f80
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -110,7 +110,7 @@ module IssuableActions
end
 
notes = prepare_notes_for_rendering(notes)
notes = notes.reject { |n| n.cross_reference_not_visible_for?(current_user) }
notes = notes.select { |n| n.visible_for?(current_user) }
 
discussions = Discussion.build_collection(notes, issuable)
 
Loading
Loading
Loading
Loading
@@ -29,7 +29,7 @@ module NotesActions
end
 
notes = prepare_notes_for_rendering(notes)
notes = notes.reject { |n| n.cross_reference_not_visible_for?(current_user) }
notes = notes.select { |n| n.visible_for?(current_user) }
 
notes_json[:notes] =
if use_note_serializer?
Loading
Loading
Loading
Loading
@@ -331,6 +331,10 @@ class Note < ApplicationRecord
cross_reference? && !all_referenced_mentionables_allowed?(user)
end
 
def visible_for?(user)
!cross_reference_not_visible_for?(user)
end
def award_emoji?
can_be_award_emoji? && contains_emoji_only?
end
Loading
Loading
---
title: Filter out old system notes for epics in notes api endpoint response
merge_request:
author:
type: security
Loading
Loading
@@ -239,7 +239,7 @@ module API
# because notes are redacted if they point to projects that
# cannot be accessed by the user.
notes = prepare_notes_for_rendering(notes)
notes.reject { |n| n.cross_reference_not_visible_for?(current_user) }
notes.select { |n| n.visible_for?(current_user) }
end
# rubocop: enable CodeReuse/ActiveRecord
end
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ module API
end
 
def update_note(noteable, note_id)
note = noteable.notes.find(params[:note_id])
note = noteable.notes.find(note_id)
 
authorize! :admin_note, note
 
Loading
Loading
@@ -61,8 +61,8 @@ module API
end
 
def get_note(noteable, note_id)
note = noteable.notes.with_metadata.find(params[:note_id])
can_read_note = !note.cross_reference_not_visible_for?(current_user)
note = noteable.notes.with_metadata.find(note_id)
can_read_note = note.visible_for?(current_user)
 
if can_read_note
present note, with: Entities::Note
Loading
Loading
Loading
Loading
@@ -42,7 +42,7 @@ module API
# array returned, but this is really a edge-case.
notes = paginate(raw_notes)
notes = prepare_notes_for_rendering(notes)
notes = notes.reject { |n| n.cross_reference_not_visible_for?(current_user) }
notes = notes.select { |note| note.visible_for?(current_user) }
present notes, with: Entities::Note
end
# rubocop: enable CodeReuse/ActiveRecord
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment