summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-07-23 14:39:19 +0000
committerRobert Speicher <rspeicher@gmail.com>2019-07-23 14:39:19 +0000
commit2eda97befe1ce32968040cf2a2b7d87611c0f091 (patch)
treeb986902bc301715429950c6f15ce37b0dc945a07
parent4435cdde49f6005fae2dabd7dade22ff94c8cea6 (diff)
parent89d5663e787dbf938f2862c735a92c7d626548dd (diff)
downloadgitlab-ce-2eda97befe1ce32968040cf2a2b7d87611c0f091.tar.gz
Merge branch '12719-group-bulk-edit-merge-requests-change-milestone-ce' into 'master'
CE port for Group bulk edit merge requests See merge request gitlab-org/gitlab-ce!30569
-rw-r--r--app/assets/javascripts/pages/groups/merge_requests/index.js4
-rw-r--r--app/views/groups/issues.html.haml2
-rw-r--r--app/views/groups/merge_requests.html.haml8
-rw-r--r--doc/user/group/bulk_editing/index.md24
-rw-r--r--doc/user/group/index.md4
-rw-r--r--doc/user/project/bulk_editing.md4
-rw-r--r--spec/services/issuable/bulk_update_service_spec.rb42
7 files changed, 57 insertions, 31 deletions
diff --git a/app/assets/javascripts/pages/groups/merge_requests/index.js b/app/assets/javascripts/pages/groups/merge_requests/index.js
index 12a26fd88fa..7520cfb6da0 100644
--- a/app/assets/javascripts/pages/groups/merge_requests/index.js
+++ b/app/assets/javascripts/pages/groups/merge_requests/index.js
@@ -1,11 +1,15 @@
import projectSelect from '~/project_select';
import initFilteredSearch from '~/pages/search/init_filtered_search';
+import issuableInitBulkUpdateSidebar from '~/issuable_init_bulk_update_sidebar';
import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
import addExtraTokensForMergeRequests from 'ee_else_ce/filtered_search/add_extra_tokens_for_merge_requests';
import { FILTERED_SEARCH } from '~/pages/constants';
+const ISSUABLE_BULK_UPDATE_PREFIX = 'merge_request_';
+
document.addEventListener('DOMContentLoaded', () => {
addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys);
+ issuableInitBulkUpdateSidebar.init(ISSUABLE_BULK_UPDATE_PREFIX);
initFilteredSearch({
page: FILTERED_SEARCH.MERGE_REQUESTS,
diff --git a/app/views/groups/issues.html.haml b/app/views/groups/issues.html.haml
index f05e269553a..2163446425c 100644
--- a/app/views/groups/issues.html.haml
+++ b/app/views/groups/issues.html.haml
@@ -13,7 +13,7 @@
= render 'shared/issuable/feed_buttons'
- if @can_bulk_update
- = render_if_exists 'shared/issuable/bulk_update_button'
+ = render_if_exists 'shared/issuable/bulk_update_button', type: :issues
= render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", type: :issues, with_feature_enabled: 'issues', with_shared: false, include_projects_in_subgroups: true
diff --git a/app/views/groups/merge_requests.html.haml b/app/views/groups/merge_requests.html.haml
index 808bb1309b1..b5a2bab4799 100644
--- a/app/views/groups/merge_requests.html.haml
+++ b/app/views/groups/merge_requests.html.haml
@@ -1,3 +1,5 @@
+- @can_bulk_update = can?(current_user, :admin_merge_request, @group)
+
- page_title "Merge Requests"
- if group_merge_requests_count(state: 'all').zero?
@@ -7,8 +9,14 @@
= render 'shared/issuable/nav', type: :merge_requests
- if current_user
.nav-controls
+ - if @can_bulk_update
+ = render_if_exists 'shared/issuable/bulk_update_button', type: :merge_requests
+
= render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request", type: :merge_requests, with_feature_enabled: 'merge_requests', with_shared: false, include_projects_in_subgroups: true
= render 'shared/issuable/search_bar', type: :merge_requests
+ - if @can_bulk_update
+ = render_if_exists 'shared/issuable/group_bulk_update_sidebar', group: @group, type: :merge_requests
+
= render 'shared/merge_requests'
diff --git a/doc/user/group/bulk_editing/index.md b/doc/user/group/bulk_editing/index.md
index 117a46da0ea..5b5f75c2dd9 100644
--- a/doc/user/group/bulk_editing/index.md
+++ b/doc/user/group/bulk_editing/index.md
@@ -1,22 +1,26 @@
-# Bulk editing issue milestones **(PREMIUM)**
+# Bulk editing issue and merge request milestones **(PREMIUM)**
-> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/7249) in
-[GitLab Ultimate](https://about.gitlab.com/pricing/) 12.1.
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/7249) for issues in
+ [GitLab Premium](https://about.gitlab.com/pricing/) 12.1.
+> - [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/12719) for merge
+ requests in GitLab [GitLab Premium](https://about.gitlab.com/pricing/) 12.2.
-NOTE: **Note:**
-A permission level of `Reporter` or higher is required in order to manage issues.
+> NOTE: **Note:**
+>
+> - A permission level of `Reporter` or higher is required in order to manage issues.
+> - A permission level of `Developer` or higher is required in order to manage merge requests.
-Milestones can be updated simultaneously across multiple issues by using the bulk editing feature.
+Milestones can be updated simultaneously across multiple issues or merge requests by using the bulk editing feature.
![Bulk editing](img/bulk-editing.png)
-To bulk update group issue milestones:
+To bulk update group issue or merge request milestones:
-1. Navigate to the issues list.
-1. Click **Edit issues**.
+1. Navigate to the issues or merge requests list.
+1. Click the **Edit issues** or **Edit merge requests** button.
- This will open a sidebar on the right-hand side of your screen where an editable field
for milestones will be displayed.
- - Checkboxes will also appear beside each issue.
+ - Checkboxes will also appear beside each issue or merge request.
1. Check the checkbox beside each issue to be edited.
1. Select the desired milestone from the sidebar.
1. Click **Update all**.
diff --git a/doc/user/group/index.md b/doc/user/group/index.md
index 7597105f36f..14c831fe671 100644
--- a/doc/user/group/index.md
+++ b/doc/user/group/index.md
@@ -78,9 +78,9 @@ Issues and merge requests are part of projects. For a given group, you can view
[issues](../project/issues/index.md#issues-list) and [merge requests](../project/merge_requests/index.md#merge-requests-per-group) across all projects in that group,
together in a single list view.
-### Bulk editing issues
+### Bulk editing issues and merge requests
-For details, see [bulk editing issues](../group/bulk_editing/index.md).
+For details, see [bulk editing issues and merge requests](../group/bulk_editing/index.md).
## Create a new group
diff --git a/doc/user/project/bulk_editing.md b/doc/user/project/bulk_editing.md
index 1783f81df3a..f4733620640 100644
--- a/doc/user/project/bulk_editing.md
+++ b/doc/user/project/bulk_editing.md
@@ -13,8 +13,8 @@ by using the bulk editing feature.
![Bulk editing](img/bulk-editing.png)
NOTE: **Note:**
-Bulk editing of merge requests is only available at the project level.
-For more details, see [bulk editing group issues](../group/bulk_editing/index.md).
+Bulk editing issues and merge requests is also available at the group level.
+For more details, see [bulk editing group issues and merge requests](../group/bulk_editing/index.md).
To update multiple project issues or merge requests at the same time:
diff --git a/spec/services/issuable/bulk_update_service_spec.rb b/spec/services/issuable/bulk_update_service_spec.rb
index b0bcd7a36ba..40da3d31408 100644
--- a/spec/services/issuable/bulk_update_service_spec.rb
+++ b/spec/services/issuable/bulk_update_service_spec.rb
@@ -16,22 +16,22 @@ describe Issuable::BulkUpdateService do
shared_examples 'updates milestones' do
it 'succeeds' do
- result = bulk_update(issues, milestone_id: milestone.id)
+ result = bulk_update(issuables, milestone_id: milestone.id)
expect(result[:success]).to be_truthy
- expect(result[:count]).to eq(issues.count)
+ expect(result[:count]).to eq(issuables.count)
end
- it 'updates the issues milestone' do
- bulk_update(issues, milestone_id: milestone.id)
+ it 'updates the issuables milestone' do
+ bulk_update(issuables, milestone_id: milestone.id)
- issues.each do |issue|
- expect(issue.reload.milestone).to eq(milestone)
+ issuables.each do |issuable|
+ expect(issuable.reload.milestone).to eq(milestone)
end
end
end
- context 'with project issues' do
+ context 'with project issuables' do
describe 'close issues' do
let(:issues) { create_list(:issue, 2, project: project) }
@@ -171,7 +171,7 @@ describe Issuable::BulkUpdateService do
end
describe 'updating milestones' do
- let(:issues) { [create(:issue, project: project)] }
+ let(:issuables) { [create(:issue, project: project)] }
let(:milestone) { create(:milestone, project: project) }
it_behaves_like 'updates milestones'
@@ -360,22 +360,32 @@ describe Issuable::BulkUpdateService do
end
end
- context 'with group issues' do
+ context 'with group issuables ' do
let(:group) { create(:group) }
- context 'updating milestone' do
+ describe 'updating milestones' do
let(:milestone) { create(:milestone, group: group) }
- let(:project1) { create(:project, :repository, group: group) }
- let(:project2) { create(:project, :repository, group: group) }
- let(:issue1) { create(:issue, project: project1) }
- let(:issue2) { create(:issue, project: project2) }
- let(:issues) { [issue1, issue2] }
+ let(:project) { create(:project, :repository, group: group) }
before do
group.add_maintainer(user)
end
- it_behaves_like 'updates milestones'
+ context 'when issues' do
+ let(:issue1) { create(:issue, project: project) }
+ let(:issue2) { create(:issue, project: project) }
+ let(:issuables) { [issue1, issue2] }
+
+ it_behaves_like 'updates milestones'
+ end
+
+ context 'when merge requests' do
+ let(:merge_request1) { create(:merge_request, source_project: project, source_branch: 'branch-1') }
+ let(:merge_request2) { create(:merge_request, source_project: project, source_branch: 'branch-2') }
+ let(:issuables) { [merge_request1, merge_request2] }
+
+ it_behaves_like 'updates milestones'
+ end
end
end
end