summaryrefslogtreecommitdiff
path: root/app/models/diff_discussion.rb
diff options
context:
space:
mode:
authorMicaël Bergeron <mbergeron@gitlab.com>2017-12-18 10:21:33 -0500
committerMicaël Bergeron <mbergeron@gitlab.com>2017-12-18 10:21:33 -0500
commitc77083a4938b42e1901a4cb69106a39a04f5c30d (patch)
tree514f1e9e5538a3124cd44dab02d973e722a24838 /app/models/diff_discussion.rb
parentc90415085d4ecf7c71c8474a4ffdb27167ab2c19 (diff)
downloadgitlab-ce-c77083a4938b42e1901a4cb69106a39a04f5c30d.tar.gz
fix the commit diff discussion sending the wrong url
it should now send you to the merge request diff path scoped to the commit.
Diffstat (limited to 'app/models/diff_discussion.rb')
-rw-r--r--app/models/diff_discussion.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/app/models/diff_discussion.rb b/app/models/diff_discussion.rb
index 4a65738214b..758a26d3c70 100644
--- a/app/models/diff_discussion.rb
+++ b/app/models/diff_discussion.rb
@@ -22,12 +22,10 @@ class DiffDiscussion < Discussion
def merge_request_version_params
return unless for_merge_request?
- return {} if active?
- if on_merge_request_commit?
- { commit_id: commit_id }
- else
- noteable.version_params_for(position.diff_refs)
+ version_params do |params|
+ params[:commit_id] = commit_id if on_merge_request_commit?
+ params
end
end
@@ -37,4 +35,15 @@ class DiffDiscussion < Discussion
position: position.to_json
)
end
+
+ private
+
+ def version_params
+ params = if active?
+ {}
+ else
+ noteable.version_params_for(position.diff_refs)
+ end
+ yield params
+ end
end