Commit d83414e6 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'remove-milestone-when-removing-issue-issue-boards' into 'master'

Removes issue milestone when removing from board with milestone

Closes gitlab-ce#29613

See merge request !1446
parents ec4788d0 a878a2b1
......@@ -23,11 +23,16 @@
const issue = this.issue;
const lists = issue.getLists();
const labelIds = lists.map(list => list.label.id);
const data = {
remove_label_ids: labelIds,
};
if (Store.state.currentBoard.milestone_id) {
data.milestone_id = -1;
}
// Post the remove data
gl.boardService.bulkUpdate([issue.globalId], {
remove_label_ids: labelIds,
}).catch(() => {
gl.boardService.bulkUpdate([issue.globalId], data).catch(() => {
new Flash('Failed to remove issue from board, please try again.', 'alert');
lists.forEach((list) => {
......
......@@ -85,6 +85,33 @@ describe 'Board with milestone', :feature, :js do
end
end
context 'removing issue from board' do
let(:label) { create(:label, project: project) }
let!(:issue) { create(:labeled_issue, project: project, labels: [label], milestone: milestone) }
let!(:board) { create(:board, project: project, milestone: milestone) }
let!(:list) { create(:list, board: board, label: label, position: 0) }
before do
visit namespace_project_boards_path(project.namespace, project)
end
it 'removes issues milestone when removing from the board' do
wait_for_vue_resource
first('.card').click
click_button('Remove from board')
visit namespace_project_issue_path(project.namespace, project, issue)
expect(page).to have_content('removed milestone')
page.within('.milestone.block') do
expect(page).to have_content('None')
end
end
end
def create_board_with_milestone
page.within '#js-multiple-boards-switcher' do
find('.dropdown-menu-toggle').click
......
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