Commit 5efbfa14 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Move complex view condition to a model method

This is moved to a model method rather than an helper method because the
API will need it too.
parent d789a4f73f40
......@@ -358,6 +358,10 @@ def editable?
!system? && !is_award
def cross_reference_not_visible_for?(user)
cross_reference? && referenced_mentionables(user).empty?
# Checks if note is an award added as a comment
# If note is an award, this method sets is_award to true
......@@ -2,11 +2,14 @@
- @discussions.each do |discussion_notes|
- note = discussion_notes.first
- if note_for_main_target?(note)
- next if note.cross_reference_not_visible_for?(current_user)
= render discussion_notes
- else
= render 'projects/notes/discussion', discussion_notes: discussion_notes
- else
- @notes.each do |note|
- next unless
- next if note.cross_reference? && note.referenced_mentionables(current_user).empty?
- next if note.cross_reference_not_visible_for?(current_user)
= render note
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment