Commit 186cbcee authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'add-multiple-assignees-feature-check-boards' into 'master'

[RUN-AS-IF-FOSS] Fix missing multiple_issue_assignees license check

See merge request gitlab-org/gitlab!61227
parents 9a8ddb4d 0c76fe2e
......@@ -32,6 +32,9 @@ export default {
import('ee_component/sidebar/components/sidebar_iteration_widget.vue'),
},
inject: {
multipleAssigneesFeatureAvailable: {
default: false,
},
epicFeatureAvailable: {
default: false,
},
......@@ -83,7 +86,7 @@ export default {
:iid="activeBoardItem.iid"
:full-path="fullPath"
:initial-assignees="activeBoardItem.assignees"
class="assignee"
:allow-multiple-assignees="multipleAssigneesFeatureAvailable"
@assignees-updated="setAssignees"
/>
<board-sidebar-epic-select v-if="epicFeatureAvailable" class="epic" />
......
......@@ -101,6 +101,9 @@ export default () => {
labelsManagePath: $boardApp.dataset.labelsManagePath,
labelsFilterBasePath: $boardApp.dataset.labelsFilterBasePath,
timeTrackingLimitToHours: parseBoolean($boardApp.dataset.timeTrackingLimitToHours),
multipleAssigneesFeatureAvailable: parseBoolean(
$boardApp.dataset.multipleAssigneesFeatureAvailable,
),
epicFeatureAvailable: parseBoolean($boardApp.dataset.epicFeatureAvailable),
iterationFeatureAvailable: parseBoolean($boardApp.dataset.iterationFeatureAvailable),
weightFeatureAvailable: parseBoolean($boardApp.dataset.weightFeatureAvailable),
......
......@@ -60,7 +60,7 @@ export default {
v-else
:users="users"
:issuable-type="issuableType"
class="gl-mt-2 hide-collapsed"
class="gl-text-gray-800 gl-mt-2 hide-collapsed"
/>
</div>
</template>
......@@ -71,8 +71,7 @@ export default {
},
allowMultipleAssignees: {
type: Boolean,
required: false,
default: true,
required: true,
},
},
data() {
......
......@@ -6,5 +6,5 @@
%sidebar-assignees-widget{ ":iid" => "String(issue.iid)",
":full-path" => "issue.path.split('/-/')[0].substring(1).replace(`#{relative_url}`, '')",
":initial-assignees" => "issue.assignees",
":multiple-assignees" => "!Boolean(#{dropdown_options[:data][:"max-select"]})",
":allow-multiple-assignees" => "!Boolean(#{dropdown_options[:data][:"max-select"]})",
"@assignees-updated" => "setAssignees" }
---
title: Fix multiple assignees checked in boards sidebar
merge_request: 61227
author:
type: fixed
......@@ -25,6 +25,7 @@ module EE
label_ids: board.label_ids,
labels: board.labels.to_json(only: [:id, :title, :color, :text_color] ),
board_weight: board.weight,
multiple_assignees_feature_available: current_board_parent.feature_available?(:multiple_issue_assignees).to_s,
weight_feature_available: current_board_parent.feature_available?(:issue_weights).to_s,
milestone_lists_available: current_board_parent.feature_available?(:board_milestone_lists).to_s,
assignee_lists_available: current_board_parent.feature_available?(:board_assignee_lists).to_s,
......
......@@ -41,12 +41,12 @@ RSpec.describe 'Issue Boards', :js do
end
context 'assignee' do
let(:assignee_widget) { '[data-testid="issue-boards-sidebar"] [data-testid="assignees-widget"]' }
let(:assignees_widget) { '[data-testid="issue-boards-sidebar"] [data-testid="assignees-widget"]' }
it 'updates the issues assignee' do
click_card(card2)
page.within(assignee_widget) do
page.within(assignees_widget) do
click_button('Edit')
wait_for_requests
......@@ -68,7 +68,7 @@ RSpec.describe 'Issue Boards', :js do
it 'adds multiple assignees' do
click_card(card1)
page.within(assignee_widget) do
page.within(assignees_widget) do
click_button('Edit')
wait_for_requests
......@@ -96,7 +96,7 @@ RSpec.describe 'Issue Boards', :js do
it 'removes the assignee' do
click_card(card1)
page.within(assignee_widget) do
page.within(assignees_widget) do
click_button('Edit')
wait_for_requests
......@@ -116,7 +116,7 @@ RSpec.describe 'Issue Boards', :js do
it 'assignees to current user' do
click_card(card2)
page.within(assignee_widget) do
page.within(assignees_widget) do
expect(page).to have_content('None')
click_button 'assign yourself'
......@@ -132,7 +132,7 @@ RSpec.describe 'Issue Boards', :js do
it 'updates assignee dropdown' do
click_card(card2)
page.within(assignee_widget) do
page.within(assignees_widget) do
click_button('Edit')
wait_for_requests
......@@ -150,12 +150,32 @@ RSpec.describe 'Issue Boards', :js do
click_card(card1)
page.within(assignee_widget) do
page.within(assignees_widget) do
click_button('Edit')
expect(find('.dropdown-menu')).to have_selector('.gl-new-dropdown-item-check-icon')
end
end
context 'when multiple assignees feature is not available' do
before do
stub_licensed_features(multiple_issue_assignees: false)
visit_project_board
end
it 'does not allow selecting multiple assignees' do
click_card(card1)
page.within(assignees_widget) do
click_button('Edit')
first('.dropdown-menu-user .gl-avatar-labeled').click
expect(page).to have_selector('.dropdown-menu', visible: false)
end
end
end
end
context 'epic' do
......
......@@ -6,8 +6,6 @@ exports[`ee/BoardContentSidebar matches the snapshot 1`] = `
<board-sidebar-title-stub />
<sidebar-assignees-widget-stub
allowmultipleassignees="true"
class="assignee"
fullpath="gitlab-org/gitlab-test"
iid="27"
initialassignees="[object Object],[object Object]"
......
......@@ -63,6 +63,28 @@ RSpec.describe BoardsHelper do
allow(helper).to receive(:can?).with(user, :admin_issue_board_list, project).and_return(false)
end
shared_examples 'serializes the availability of a licensed feature' do |feature_name, feature_key|
context "when '#{feature_name}' is available" do
before do
stub_licensed_features({ feature_name => true })
end
it "indicates that the feature is available in a boolean string" do
expect(board_data[feature_key]).to eq("true")
end
end
context "when '#{feature_name}' is unavailable" do
before do
stub_licensed_features({ feature_name => false })
end
it "indicates that the feature is unavailable in a boolean string" do
expect(board_data[feature_key]).to eq("false")
end
end
end
context 'when no iteration', :aggregate_failures do
it 'serializes board without iteration' do
expect(board_data[:board_iteration_title]).to be_nil
......@@ -82,6 +104,17 @@ RSpec.describe BoardsHelper do
expect(board_data[:board_iteration_id]).to eq(iteration.id)
end
end
[[:multiple_issue_assignees, :multiple_assignees_feature_available],
[:issue_weights, :weight_feature_available],
[:board_milestone_lists, :milestone_lists_available],
[:board_assignee_lists, :assignee_lists_available],
[:board_iteration_lists, :iteration_lists_available],
[:epics, :epic_feature_available],
[:iterations, :iteration_feature_available],
[:scoped_labels, :scoped_labels]].each do |feature_name, feature_key|
include_examples "serializes the availability of a licensed feature", feature_name, feature_key
end
end
context 'epic board' do
......
......@@ -18,6 +18,8 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
let(:card) { find('.board:nth-child(2)').first('.board-card') }
before do
stub_licensed_features(multiple_issue_assignees: false)
project.add_maintainer(user)
sign_in(user)
......@@ -27,10 +29,12 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
end
context 'assignee' do
let(:assignees_widget) { '[data-testid="issue-boards-sidebar"] [data-testid="assignees-widget"]' }
it 'updates the issues assignee' do
click_card(card)
page.within('.assignee') do
page.within(assignees_widget) do
click_button('Edit')
wait_for_requests
......@@ -41,12 +45,11 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
first('.gl-avatar-labeled').click
end
click_button('Apply')
wait_for_requests
expect(page).to have_content(assignee)
end
wait_for_requests
expect(card).to have_selector('.avatar')
end
......@@ -54,7 +57,7 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
card_two = find('.board:nth-child(2)').find('.board-card:nth-child(2)')
click_card(card_two)
page.within('.assignee') do
page.within(assignees_widget) do
click_button('Edit')
wait_for_requests
......@@ -63,9 +66,6 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
find('[data-testid="unassign"]').click
end
click_button('Apply')
wait_for_requests
expect(page).to have_content('None')
end
......@@ -75,7 +75,7 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
it 'assignees to current user' do
click_card(card)
page.within(find('.assignee')) do
page.within(assignees_widget) do
expect(page).to have_content('None')
click_button 'assign yourself'
......@@ -91,7 +91,7 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
it 'updates assignee dropdown' do
click_card(card)
page.within('.assignee') do
page.within(assignees_widget) do
click_button('Edit')
wait_for_requests
......@@ -102,9 +102,6 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
first('.gl-avatar-labeled').click
end
click_button('Apply')
wait_for_requests
expect(page).to have_content(assignee)
end
......@@ -112,7 +109,7 @@ RSpec.describe 'Project issue boards sidebar assignee', :js do
find('.board-card:nth-child(2)').click
end
page.within('.assignee') do
page.within(assignees_widget) do
click_button('Edit')
expect(find('.dropdown-menu')).to have_selector('.gl-new-dropdown-item-check-icon')
......
......@@ -65,6 +65,7 @@ describe('Sidebar assignees widget', () => {
iid: '1',
issuableId: 0,
fullPath: '/mygroup/myProject',
allowMultipleAssignees: true,
...props,
},
provide: {
......
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