summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-06-01 09:05:21 -0500
committerDouwe Maan <douwe@selenight.nl>2017-06-01 09:52:11 -0500
commit34fcade1fd104deecaba69dc050cf2dcabb9e866 (patch)
tree26dc1481a2ffbfd2f464811ea7f0d4558733598a /app
parentc72abcefe79dd906cbbf0088b442a8979e9fc746 (diff)
downloadgitlab-ce-34fcade1fd104deecaba69dc050cf2dcabb9e866.tar.gz
Fix replying to a commit discussion displayed in the context of an MR
Diffstat (limited to 'app')
-rw-r--r--app/helpers/notes_helper.rb2
-rw-r--r--app/models/discussion.rb6
2 files changed, 7 insertions, 1 deletions
diff --git a/app/helpers/notes_helper.rb b/app/helpers/notes_helper.rb
index 375110b77e2..3d4802290b5 100644
--- a/app/helpers/notes_helper.rb
+++ b/app/helpers/notes_helper.rb
@@ -50,7 +50,7 @@ module NotesHelper
def link_to_reply_discussion(discussion, line_type = nil)
return unless current_user
- data = { discussion_id: discussion.id, line_type: line_type }
+ data = { discussion_id: discussion.reply_id, line_type: line_type }
button_tag 'Reply...', class: 'btn btn-text-field js-discussion-reply-button',
data: data, title: 'Add a reply'
diff --git a/app/models/discussion.rb b/app/models/discussion.rb
index 9b32d573387..d1cec7613af 100644
--- a/app/models/discussion.rb
+++ b/app/models/discussion.rb
@@ -85,6 +85,12 @@ class Discussion
first_note.discussion_id(context_noteable)
end
+ def reply_id
+ # To reply to this discussion, we need the actual discussion_id from the database,
+ # not the potentially overwritten one based on the noteable.
+ first_note.discussion_id
+ end
+
alias_method :to_param, :id
def diff_discussion?