rework the merge_request_version_params to use Object#tap

This commit is contained in:
Micaël Bergeron 2017-12-18 12:02:45 -05:00
parent c77083a493
commit a794b161cd

View file

@ -23,9 +23,8 @@ class DiffDiscussion < Discussion
def merge_request_version_params
return unless for_merge_request?
version_params do |params|
version_params.tap do |params|
params[:commit_id] = commit_id if on_merge_request_commit?
params
end
end
@ -39,11 +38,8 @@ class DiffDiscussion < Discussion
private
def version_params
params = if active?
{}
else
noteable.version_params_for(position.diff_refs)
end
yield params
return {} if active?
noteable.version_params_for(position.diff_refs)
end
end