Commit 73a066c2 authored by Robert Schilling's avatar Robert Schilling

Merge branch 'cleanup-7180' into 'master'

A simpler implementation of finding a merge request

## What does this MR do?

This cleans up some code in the issues API as discussed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7180#note_19501743

The helper method `merge_request_for_resolving_discussions` was no longer needed as it was only used once. That made it possible to simplify the implementation.

## Does this MR meet the acceptance criteria?

- [x] ~~[Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added~~
- [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [x] ~~API support added~~
- Tests
  - [x] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

!7180

See merge request !7955
parents 180f87ca 51a921ba
......@@ -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'])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment