diff options
author | Patrick Derichs <pderichs@gitlab.com> | 2019-08-09 14:54:57 +0200 |
---|---|---|
committer | Patrick Derichs <pderichs@gitlab.com> | 2019-08-28 15:04:23 +0200 |
commit | c9b4dc677abdebc02ecac4dca65a759d3f07b2a0 (patch) | |
tree | bc19401d0e29a912d6db7d13cc4fea71d68beda2 /app | |
parent | 20920f8074a45c0e2c3bbeab9be44e7b6d1dd398 (diff) | |
download | gitlab-ce-c9b4dc677abdebc02ecac4dca65a759d3f07b2a0.tar.gz |
Filter out old system notes for epics
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/concerns/issuable_actions.rb | 2 | ||||
-rw-r--r-- | app/controllers/concerns/notes_actions.rb | 2 | ||||
-rw-r--r-- | app/models/note.rb | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/concerns/issuable_actions.rb b/app/controllers/concerns/issuable_actions.rb index b86e4451a7e..1d6a1be402c 100644 --- a/app/controllers/concerns/issuable_actions.rb +++ b/app/controllers/concerns/issuable_actions.rb @@ -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) diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb index d2a961efff7..80be7095ed3 100644 --- a/app/controllers/concerns/notes_actions.rb +++ b/app/controllers/concerns/notes_actions.rb @@ -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? diff --git a/app/models/note.rb b/app/models/note.rb index a12d1eb7243..fae66ce7e4a 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -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 |