Commit cc26580c authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch '246905-only-allow-multiple-reviewers-in-paid-tiers' into 'master'

Only allow multiple reviewers in paid tiers

See merge request gitlab-org/gitlab!44097
parents 9cbbfab1 4ad86a7b
......@@ -75,9 +75,9 @@ export default {
:root-path="rootPath"
:issuable-type="issuableType"
>
<div class="ml-2">
<span class="author"> {{ user.name }} </span>
<span class="username"> {{ username }} </span>
<div class="gl-ml-3 gl-line-height-normal">
<div class="author">{{ user.name }}</div>
<div class="username">{{ username }}</div>
</div>
</reviewer-avatar-link>
<div v-else>
......
......@@ -56,7 +56,7 @@ module FormHelper
end
def reviewers_dropdown_options(issuable_type)
{
dropdown_data = {
toggle_class: 'js-reviewer-search js-multiselect js-save-user-data',
title: 'Request review from',
filter: true,
......@@ -69,13 +69,20 @@ module FormHelper
project_id: (@target_project || @project)&.id,
field_name: "#{issuable_type}[reviewer_ids][]",
default_label: 'Unassigned',
'dropdown-header': 'Reviewer(s)',
'max-select': 1,
'dropdown-header': 'Reviewer',
multi_select: true,
'input-meta': 'name',
'always-show-selectbox': true,
current_user_info: UserSerializer.new.represent(current_user)
}
}
if merge_request_supports_multiple_reviewers?
dropdown_data = multiple_reviewers_dropdown_options(dropdown_data)
end
dropdown_data
end
# Overwritten
......@@ -88,6 +95,11 @@ module FormHelper
false
end
# Overwritten
def merge_request_supports_multiple_reviewers?
false
end
private
def multiple_assignees_dropdown_options(options)
......@@ -99,6 +111,16 @@ module FormHelper
new_options
end
def multiple_reviewers_dropdown_options(options)
new_options = options.dup
new_options[:title] = _('Select reviewer(s)')
new_options[:data][:'dropdown-header'] = _('Reviewer(s)')
new_options[:data].delete(:'max-select')
new_options
end
end
FormHelper.prepend_if_ee('::EE::FormHelper')
......@@ -9,5 +9,9 @@ module EE
def merge_request_supports_multiple_assignees?
@merge_request&.allows_multiple_assignees?
end
def merge_request_supports_multiple_reviewers?
@merge_request&.allows_multiple_reviewers?
end
end
end
---
title: Only allow multiple reviewers in paid tiers
merge_request: 44097
author:
type: changed
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Merge request > User creates MR with multiple reviewers' do
include_context 'merge request create context'
before do
stub_licensed_features(multiple_merge_request_reviewers: true)
end
it_behaves_like 'multiple reviewers merge request', 'creates', 'Submit merge request'
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Merge request > User edits MR with multiple reviewers' do
include_context 'merge request edit context'
before do
stub_licensed_features(multiple_merge_request_reviewers: true)
end
it_behaves_like 'multiple reviewers merge request', 'updates', 'Save changes'
end
......@@ -23218,6 +23218,9 @@ msgstr ""
msgid "Select required regulatory standard"
msgstr ""
msgid "Select reviewer(s)"
msgstr ""
msgid "Select shards to replicate"
msgstr ""
......
# frozen_string_literal: true
RSpec.shared_examples 'multiple reviewers merge request' do |action, save_button_title|
it "#{action} a MR with multiple reviewers", :js do
find('.js-reviewer-search').click
page.within '.dropdown-menu-user' do
click_link user.name
click_link user2.name
end
# Extra click needed in order to toggle the dropdown
find('.js-reviewer-search').click
expect(all('input[name="merge_request[reviewer_ids][]"]', visible: false).map(&:value))
.to match_array([user.id.to_s, user2.id.to_s])
page.within '.js-reviewer-search' do
expect(page).to have_content "#{user2.name} + 1 more"
end
click_button save_button_title
page.within '.issuable-sidebar' do
page.within '.reviewer' do
expect(page).to have_content '2 Reviewers'
click_link 'Edit'
expect(page).to have_content user.name
expect(page).to have_content user2.name
end
end
page.within '.dropdown-menu-user' do
click_link user.name
end
page.within '.issuable-sidebar' do
page.within '.reviewer' do
# Closing dropdown to persist
click_link 'Edit'
expect(page).to have_content user2.name
end
end
end
end
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