diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2016-12-06 17:13:14 +0100 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2016-12-06 17:46:52 +0100 |
commit | 51a921baf90be2a6654990b9b7d062f4c613a64b (patch) | |
tree | e23f14d883f9c5bf2361f1513a255f89f8557fd8 /lib | |
parent | 469dfa43cf794219b5a5508168e762adc5db83ea (diff) | |
download | gitlab-ce-51a921baf90be2a6654990b9b7d062f4c613a64b.tar.gz |
A simpler implementation of finding a merge request
Following a discussion in !7180
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/issues.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index cfb7c45de8e..26c8f2fecd0 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -28,14 +28,6 @@ module API new_params end - - def merge_request_for_resolving_discussions - return unless merge_request_iid = params[:merge_request_for_resolving_discussions] - - @merge_request_for_resolving_discussions ||= MergeRequestsFinder.new(current_user, project_id: user_project.id). - execute. - find_by(iid: merge_request_iid) - end end resource :issues do @@ -179,7 +171,12 @@ module API attrs = attributes_for_keys(keys) attrs[:labels] = params[:labels] if params[:labels] - attrs[:merge_request_for_resolving_discussions] = merge_request_for_resolving_discussions if params[:merge_request_for_resolving_discussions] + + if merge_request_iid = params[:merge_request_for_resolving_discussions] + attrs[:merge_request_for_resolving_discussions] = MergeRequestsFinder.new(current_user, project_id: user_project.id). + execute. + find_by(iid: merge_request_iid) + end # Convert and filter out invalid confidential flags attrs['confidential'] = to_boolean(attrs['confidential']) |