Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-06-01 19:25:01 +0300
committerGrzegorz Bizon <grzegorz@gitlab.com>2017-06-01 19:25:01 +0300
commit42c13b26dab4f52e90bc8be2b6f46d2ef9559ccd (patch)
treeea67068a120b356a398ff3b7cba669e37362ecf8 /app
parentdb48f5ce666fb727940e507f1e1de7071b1017b9 (diff)
parent34fcade1fd104deecaba69dc050cf2dcabb9e866 (diff)
Merge branch 'dm-comment-on-mr-commit-discussion' into 'master'
Fix replying to a commit discussion displayed in the context of an MR Closes #33201 See merge request !11847
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?