Commit ca0b1d49 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira

Remove correct labels and weight when removing issue from board

parent 2d3b2b7c
...@@ -30,12 +30,16 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({ ...@@ -30,12 +30,16 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
}, },
methods: { methods: {
removeIssue() { removeIssue() {
const board = Store.state.currentBoard;
const issue = this.issue; const issue = this.issue;
const lists = issue.getLists(); const lists = issue.getLists();
const boardLabelIds = board.labels.map(label => label.id);
const listLabelIds = lists.map(list => list.label.id); const listLabelIds = lists.map(list => list.label.id);
let labelIds = this.issue.labels let labelIds = this.issue.labels
.map(label => label.id) .map(label => label.id)
.filter(id => !listLabelIds.includes(id)); .filter(id => !listLabelIds.includes(id))
.filter(id => !boardLabelIds.includes(id));
if (labelIds.length === 0) { if (labelIds.length === 0) {
labelIds = ['']; labelIds = [''];
} }
...@@ -44,10 +48,15 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({ ...@@ -44,10 +48,15 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
label_ids: labelIds, label_ids: labelIds,
}, },
}; };
if (Store.state.currentBoard.milestone_id) {
if (board.milestone_id) {
data.issue.milestone_id = -1; data.issue.milestone_id = -1;
} }
if (board.weight) {
data.issue.weight = null;
}
// Post the remove data // Post the remove data
Vue.http.patch(this.updateUrl, data).catch(() => { Vue.http.patch(this.updateUrl, data).catch(() => {
new Flash('Failed to remove issue from board, please try again.', 'alert'); new Flash('Failed to remove issue from board, please try again.', 'alert');
......
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