diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-10-11 20:20:38 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-10-11 20:20:38 +0300 |
commit | d57d892e3fd4d73a477ba5c1b0049864f7c9e6b2 (patch) | |
tree | 40e6f028bd2769b405099c742956ebf4260929e7 /app/helpers | |
parent | 9db841127bef1509d32ae5f3ff2458923c84a19d (diff) | |
parent | 6606642f8f352267d9f645778a789b79d98a6ca8 (diff) |
Merge branch 'assign-issues-for-merge-request-18876' into 'master'
Ability to bulk assign issues to author of merge request
## What does this MR do?
Provides a link to auto-assign issues to the author of a merge request, when they are mentioned as being closed by the MR.
## Are there points in the code the reviewer needs to double check?
## Why was this MR needed?
To help avoid working on a MR without having assigned related issues to self
## What are the relevant issue numbers?
Fixes #18876
## Screenshots (if relevant)
![ScreenShot-P216](/uploads/1af5e71a0a0ff0a60c5d7b54c0e09d9c/ScreenShot-P216.png)
## Tasks
- [x] Refactor or move away from using `BulkUpdateService`
- [x] ~~Consider alternate link message when only a subset of issues will be assigned~~
- [x] Minimize repeated calls to expensive `closes_issues` method
- [x] Move away from using inflector for pluralization and fix flash message
- [x] Change auth `before_action` and fallback to error flash message
- [x] Shouldn't overwrite current assignee if one exists
## Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry 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
- [x] All builds are passing
- [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 you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5725
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/merge_requests_helper.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 8abe7865fed..b0a76765d97 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -72,6 +72,19 @@ module MergeRequestsHelper ) end + def mr_assign_issues_link + issues = MergeRequests::AssignIssuesService.new(@project, + current_user, + merge_request: @merge_request, + closes_issues: mr_closes_issues + ).assignable_issues + path = assign_related_issues_namespace_project_merge_request_path(@project.namespace, @project, @merge_request) + if issues.present? + pluralize_this_issue = issues.count > 1 ? "these issues" : "this issue" + link_to "Assign yourself to #{pluralize_this_issue}", path, method: :post + end + end + def source_branch_with_namespace(merge_request) branch = link_to(merge_request.source_branch, namespace_project_commits_path(merge_request.source_project.namespace, merge_request.source_project, merge_request.source_branch)) |