summaryrefslogtreecommitdiff
path: root/app/controllers/projects/notes_controller.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-07-28 20:09:36 -0600
committerDouwe Maan <douwe@selenight.nl>2016-07-28 20:09:36 -0600
commit1c2eefef3f67d9d221b6465ec77907940732e789 (patch)
tree36c66b062f5d328ea3cd41aea5d8ea483f08efe8 /app/controllers/projects/notes_controller.rb
parent6d9715d8777265737c076abe06362d2a8e9e498d (diff)
downloadgitlab-ce-1c2eefef3f67d9d221b6465ec77907940732e789.tar.gz
Backend tweaks
Diffstat (limited to 'app/controllers/projects/notes_controller.rb')
-rw-r--r--app/controllers/projects/notes_controller.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb
index 59b8e88c8d7..027a2d7dcb2 100644
--- a/app/controllers/projects/notes_controller.rb
+++ b/app/controllers/projects/notes_controller.rb
@@ -72,11 +72,11 @@ class Projects::NotesController < Projects::ApplicationController
note.resolve!(current_user)
- discussion = note.noteable.discussions.find { |d| d.id == note.discussion_id } || render_404
+ discussion = note.discussion
render json: {
resolved_by: note.resolved_by.try(:name),
- updated_html: view_to_html_string('discussions/_headline', discussion: discussion)
+ discussion_headline_html: (view_to_html_string('discussions/_headline', discussion: discussion) if discussion)
}
end
@@ -85,10 +85,10 @@ class Projects::NotesController < Projects::ApplicationController
note.unresolve!
- discussion = note.noteable.discussions.find { |d| d.id == note.discussion_id } || render_404
+ discussion = note.discussion
render json: {
- updated_html: view_to_html_string('discussions/_headline', discussion: discussion)
+ discussion_headline_html: (view_to_html_string('discussions/_headline', discussion: discussion) if discussion)
}
end
@@ -164,7 +164,7 @@ class Projects::NotesController < Projects::ApplicationController
}
if note.diff_note?
- discussion = Discussion.new([note])
+ discussion = note.as_discussion
attrs.merge!(
diff_discussion_html: diff_discussion_html(discussion),