Commit d5536cfa authored by Florie Guibert's avatar Florie Guibert

Fix - Some users cannot move issues in epic swimlanes

Changelog: fixed
EE: true
parent d81233e7
......@@ -51,7 +51,9 @@ export default {
computed: {
...mapState(['activeId', 'filterParams', 'canAdminEpic', 'listsFlags', 'highlightedLists']),
treeRootWrapper() {
return this.canAdminList && this.canAdminEpic ? Draggable : 'ul';
return this.canAdminList && (this.canAdminEpic || this.isUnassignedIssuesLane)
? Draggable
: 'ul';
},
treeRootOptions() {
const options = {
......
......@@ -16,17 +16,10 @@ RSpec.describe 'epics swimlanes', :js do
let_it_be(:list) { create(:list, board: board, label: label, position: 0) }
let_it_be(:issue1) { create(:issue, project: project, labels: [label]) }
let_it_be(:issue2) { create(:issue, project: project) }
let_it_be(:issue3) { create(:issue, project: project, state: :closed) }
let_it_be(:issue4) { create(:issue, project: project) }
let_it_be(:epic1) { create(:epic, group: group) }
let_it_be(:epic2) { create(:epic, group: group) }
let_it_be(:epic_issue1) { create(:epic_issue, epic: epic1, issue: issue1) }
let_it_be(:epic_issue2) { create(:epic_issue, epic: epic2, issue: issue2) }
let_it_be(:epic_issue3) { create(:epic_issue, epic: epic2, issue: issue3) }
before do
project.add_maintainer(user)
group.add_maintainer(user)
......@@ -38,7 +31,27 @@ RSpec.describe 'epics swimlanes', :js do
load_unassigned_issues
end
context 'when no epic is displayed' do
it('user can drag and drop between columns') do
wait_for_board_cards_in_unassigned_lane(1, 1)
epic_lanes = page.all(:css, '.board-epic-lane')
expect(epic_lanes.length).to eq(0)
drag(list_from_index: 1, list_to_index: 0)
wait_for_board_cards_in_unassigned_lane(0, 1)
end
end
context 'drag and drop issue' do
let_it_be(:issue2) { create(:issue, project: project) }
let_it_be(:issue3) { create(:issue, project: project, state: :closed) }
let_it_be(:issue4) { create(:issue, project: project) }
let_it_be(:epic_issue1) { create(:epic_issue, epic: epic1, issue: issue1) }
let_it_be(:epic_issue2) { create(:epic_issue, epic: epic2, issue: issue2) }
let_it_be(:epic_issue3) { create(:epic_issue, epic: epic2, issue: issue3) }
it 'between epics' do
wait_for_board_cards(1, 2)
wait_for_board_cards_in_first_epic(0, 1)
......
import { shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue';
import Draggable from 'vuedraggable';
import IssuesLaneList from 'ee/boards/components/issues_lane_list.vue';
import { mockList } from 'jest/boards/mock_data';
import BoardCard from '~/boards/components/board_card.vue';
......@@ -11,7 +12,11 @@ describe('IssuesLaneList', () => {
let wrapper;
let store;
const createComponent = ({ listType = ListType.backlog, collapsed = false } = {}) => {
const createComponent = ({
listType = ListType.backlog,
collapsed = false,
isUnassignedIssuesLane = false,
} = {}) => {
const listMock = {
...mockList,
listType,
......@@ -30,6 +35,7 @@ describe('IssuesLaneList', () => {
issues: mockIssues,
disabled: false,
canAdminList: true,
isUnassignedIssuesLane,
},
});
};
......@@ -71,6 +77,24 @@ describe('IssuesLaneList', () => {
});
});
describe('drag & drop permissions', () => {
beforeEach(() => {
store = createStore();
createComponent();
});
it('user cannot drag on epic lane if canAdminEpic is false', () => {
expect(wrapper.vm.treeRootWrapper).toBe('ul');
});
it('user can drag on unassigned lane if canAdminEpic is false', () => {
createComponent({ isUnassignedIssuesLane: true });
expect(wrapper.vm.treeRootWrapper).toBe(Draggable);
});
});
describe('drag & drop issue', () => {
beforeEach(() => {
const defaultStore = createStore();
......
......@@ -282,7 +282,11 @@ describe('fetchEpicsSwimlanes', () => {
[
{
type: types.RECEIVE_EPICS_SUCCESS,
payload: { epics: [mockEpic], hasMoreEpics: true, epicsEndCursor: 'ENDCURSOR' },
payload: {
epics: [mockEpic],
hasMoreEpics: true,
epicsEndCursor: 'ENDCURSOR',
},
},
],
[],
......
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