Commit 63ac5f1f authored by Simon Knox's avatar Simon Knox

simplify and clarify some assignments

parent 855966c5
......@@ -41,14 +41,10 @@ export default {
},
methods: {
labelStyle(label) {
let style = '';
if (label.textColor) {
style += `color: ${label.textColor};`
}
if (label.color) {
style += `background-color: ${label.color};`
}
return style;
return {
color: label.textColor,
backgroundColor: label.color,
};
},
},
};
......
......@@ -46,14 +46,17 @@ export default {
},
methods: {
selectMilestone(milestone) {
let id = milestone.id;
// swap the IDs of 'Any' and 'No' milestone to what backend requires
if (milestone.title === ANY_MILESTONE) {
milestone.id = -1;
id = -1;
} else if (milestone.title === NO_MILESTONE) {
milestone.id = 0;
id = 0;
}
this.$set(this.board, 'milestone_id', milestone.id);
this.$set(this.board, 'milestone', milestone);
this.board.milestone = {
...milestone,
id,
};
},
},
mounted() {
......
......@@ -48,13 +48,14 @@ gl.issueBoards.RemoveIssueBtn = Vue.extend({
.map(assignee => assignee.id)
.filter(id => id !== board.assignee_id);
if (assigneeIds.length === 0) {
// for backend to explicitly set No Assignee
assigneeIds = ['0'];
}
const data = {
issue: {
label_ids: labelIds,
assignee_ids: assigneeIds
assignee_ids: assigneeIds,
},
};
......
......@@ -60,11 +60,9 @@ gl.issueBoards.BoardsStore = {
this.boardConfig.id = board.id;
this.boardConfig.name = board.name;
this.boardConfig.milestone = board.milestone;
this.boardConfig.milestone_id = board.milestone_id;
this.boardConfig.weight = board.weight;
this.boardConfig.labels = board.labels || [];
this.boardConfig.assignee_id = board.assignee_id;
this.boardConfig.assignee = board.assignee || {};
this.boardConfig.weight = board.weight;
},
addList (listObj, defaultAvatar) {
const list = new List(listObj, defaultAvatar);
......
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