Commit 0c76fe2e authored by Eulyeon Ko's avatar Eulyeon Ko Committed by Mayra Cabrera

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

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