diff options
Diffstat (limited to 'app/models/diff_discussion.rb')
-rw-r--r-- | app/models/diff_discussion.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/app/models/diff_discussion.rb b/app/models/diff_discussion.rb index 07c4846e2ac..bd6af622bfb 100644 --- a/app/models/diff_discussion.rb +++ b/app/models/diff_discussion.rb @@ -11,6 +11,8 @@ class DiffDiscussion < Discussion delegate :position, :original_position, :change_position, + :on_text?, + :on_image?, to: :first_note @@ -20,9 +22,15 @@ class DiffDiscussion < Discussion def merge_request_version_params return unless for_merge_request? - return {} if active? - noteable.version_params_for(position.diff_refs) + version_params = get_params + + return version_params unless on_merge_request_commit? && commit_id + + version_params ||= {} + version_params.tap do |params| + params[:commit_id] = commit_id + end end def reply_attributes @@ -31,4 +39,12 @@ class DiffDiscussion < Discussion position: position.to_json ) end + + private + + def get_params + return {} if active? + + noteable.version_params_for(position.diff_refs) + end end |