diff options
Diffstat (limited to 'app/controllers/concerns/renders_notes.rb')
-rw-r--r-- | app/controllers/concerns/renders_notes.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/concerns/renders_notes.rb b/app/controllers/concerns/renders_notes.rb index 41c3114ad1e..cdcfefd90c9 100644 --- a/app/controllers/concerns/renders_notes.rb +++ b/app/controllers/concerns/renders_notes.rb @@ -1,7 +1,8 @@ module RendersNotes - def prepare_notes_for_rendering(notes) + def prepare_notes_for_rendering(notes, noteable=nil) preload_noteable_for_regular_notes(notes) preload_max_access_for_authors(notes, @project) + preload_first_time_contribution_for_authors(noteable, notes) if noteable.is_a?(Issuable) Banzai::NoteRenderer.render(notes, @project, current_user) notes @@ -19,4 +20,10 @@ module RendersNotes def preload_noteable_for_regular_notes(notes) ActiveRecord::Associations::Preloader.new.preload(notes.reject(&:for_commit?), :noteable) end + + def preload_first_time_contribution_for_authors(issuable, notes) + return unless issuable.first_contribution? + same_author = lambda {|n| n.author_id == issuable.author_id} + notes.select(&same_author).each {|note| note.special_role = :first_time_contributor} + end end |