summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/renders_notes.rb
diff options
context:
space:
mode:
authorJose Ivan Vargas <jvargas@gitlab.com>2017-09-13 12:21:33 -0500
committerJose Ivan Vargas <jvargas@gitlab.com>2017-09-13 12:21:33 -0500
commit4c0beb6c024b25ff24c7c2ea966bacab0ee860d5 (patch)
treef3e61556a1cc9132f439d222dca9d6366eb8a6ca /app/controllers/concerns/renders_notes.rb
parent2d58626a33bc0d4e78eaf0c25965d18a6239fa3b (diff)
parent33010da28b0f2e00e96cc4bf6c439363905a81d5 (diff)
downloadgitlab-ce-4c0beb6c024b25ff24c7c2ea966bacab0ee860d5.tar.gz
Merge branch 'master' into sh-headless-chrome-support
Diffstat (limited to 'app/controllers/concerns/renders_notes.rb')
-rw-r--r--app/controllers/concerns/renders_notes.rb9
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..4791bc561a4 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)
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(noteable, notes)
+ return unless noteable.is_a?(Issuable) && noteable.first_contribution?
+
+ notes.each {|n| n.specialize_for_first_contribution!(noteable)}
+ end
end