diff options
author | Phil Hughes <me@iamphill.com> | 2016-07-27 20:34:04 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-07-27 20:34:04 +0300 |
commit | 2247d8a4fd7f77e1a4b8a50becdd08643435f19d (patch) | |
tree | 7a3e9c5769894b1e04cb66a95f7192ebd1d80e4c /app/controllers/projects | |
parent | 86446846e963ea1304b56fa74b4ca795a491bbb5 (diff) |
Updates the text above discussions when resolving notes & discussions
Diffstat (limited to 'app/controllers/projects')
-rw-r--r-- | app/controllers/projects/discussions_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/projects/notes_controller.rb | 11 |
2 files changed, 14 insertions, 4 deletions
diff --git a/app/controllers/projects/discussions_controller.rb b/app/controllers/projects/discussions_controller.rb index 8a79cac60c1..47f301a08d9 100644 --- a/app/controllers/projects/discussions_controller.rb +++ b/app/controllers/projects/discussions_controller.rb @@ -10,7 +10,8 @@ class Projects::DiscussionsController < Projects::ApplicationController discussion.resolve!(current_user) render json: { - resolved_by: discussion.resolved_by.try(:name) + resolved_by: discussion.resolved_by.try(:name), + updated_html: view_to_html_string('discussions/_headline', discussion: discussion) } end @@ -19,7 +20,9 @@ class Projects::DiscussionsController < Projects::ApplicationController discussion.unresolve! - head :ok + render json: { + updated_html: view_to_html_string('discussions/_headline', discussion: discussion) + } end private diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index ad7376b8574..59b8e88c8d7 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -72,8 +72,11 @@ class Projects::NotesController < Projects::ApplicationController note.resolve!(current_user) + discussion = note.noteable.discussions.find { |d| d.id == note.discussion_id } || render_404 + render json: { - resolved_by: note.resolved_by.try(:name) + resolved_by: note.resolved_by.try(:name), + updated_html: view_to_html_string('discussions/_headline', discussion: discussion) } end @@ -82,7 +85,11 @@ class Projects::NotesController < Projects::ApplicationController note.unresolve! - head :ok + discussion = note.noteable.discussions.find { |d| d.id == note.discussion_id } || render_404 + + render json: { + updated_html: view_to_html_string('discussions/_headline', discussion: discussion) + } end private |