summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authormicael.bergeron <micael.bergeron@solutionstlm.com>2017-08-02 10:06:28 -0400
committermicael.bergeron <micael.bergeron@solutionstlm.com>2017-09-06 09:00:57 -0400
commit45b83ed99afc5cfe24a8d84869894124d93d5b51 (patch)
treed632a83e4b953d627855440defbc3300b1285967 /app/controllers
parent966b1128d884a318dad4277e23368334fe67e836 (diff)
downloadgitlab-ce-45b83ed99afc5cfe24a8d84869894124d93d5b51.tar.gz
round of fixes after code review
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/concerns/renders_notes.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/concerns/renders_notes.rb b/app/controllers/concerns/renders_notes.rb
index cdcfefd90c9..b6cf366c05c 100644
--- a/app/controllers/concerns/renders_notes.rb
+++ b/app/controllers/concerns/renders_notes.rb
@@ -1,5 +1,5 @@
module RendersNotes
- def prepare_notes_for_rendering(notes, noteable=nil)
+ 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)
@@ -23,7 +23,10 @@ module RendersNotes
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}
+ notes.each do |note|
+ note.specialize!(Note::SpecialRole::FIRST_TIME_CONTRIBUTOR, &same_author)
+ end
end
end