Merge branch 'moving-issue-with-two-list-labels' into 'master'
Removes label from previous list Closes #28484 See merge request !9418
This commit is contained in:
commit
ed707dde8d
4 changed files with 37 additions and 5 deletions
|
@ -123,14 +123,18 @@ class List {
|
||||||
|
|
||||||
if (listFrom) {
|
if (listFrom) {
|
||||||
this.issuesSize += 1;
|
this.issuesSize += 1;
|
||||||
gl.boardService.moveIssue(issue.id, listFrom.id, this.id)
|
this.updateIssueLabel(issue, listFrom);
|
||||||
.then(() => {
|
|
||||||
listFrom.getIssues(false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateIssueLabel(issue, listFrom) {
|
||||||
|
gl.boardService.moveIssue(issue.id, listFrom.id, this.id)
|
||||||
|
.then(() => {
|
||||||
|
listFrom.getIssues(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
findIssue (id) {
|
findIssue (id) {
|
||||||
return this.issues.filter(issue => issue.id === id)[0];
|
return this.issues.filter(issue => issue.id === id)[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,9 +92,12 @@
|
||||||
const issueLists = issue.getLists();
|
const issueLists = issue.getLists();
|
||||||
const listLabels = issueLists.map(listIssue => listIssue.label);
|
const listLabels = issueLists.map(listIssue => listIssue.label);
|
||||||
|
|
||||||
// Add to new lists issues if it doesn't already exist
|
|
||||||
if (!issueTo) {
|
if (!issueTo) {
|
||||||
|
// Add to new lists issues if it doesn't already exist
|
||||||
listTo.addIssue(issue, listFrom, newIndex);
|
listTo.addIssue(issue, listFrom, newIndex);
|
||||||
|
} else {
|
||||||
|
listTo.updateIssueLabel(issue, listFrom);
|
||||||
|
issueTo.removeLabel(listFrom.label);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listTo.type === 'done') {
|
if (listTo.type === 'done') {
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
title: Removes label when moving issue to another list that it is currently in
|
||||||
|
merge_request:
|
||||||
|
author:
|
|
@ -3,7 +3,9 @@
|
||||||
/* global boardsMockInterceptor */
|
/* global boardsMockInterceptor */
|
||||||
/* global BoardService */
|
/* global BoardService */
|
||||||
/* global List */
|
/* global List */
|
||||||
|
/* global ListIssue */
|
||||||
/* global listObj */
|
/* global listObj */
|
||||||
|
/* global listObjDuplicate */
|
||||||
|
|
||||||
require('~/lib/utils/url_utility');
|
require('~/lib/utils/url_utility');
|
||||||
require('~/boards/models/issue');
|
require('~/boards/models/issue');
|
||||||
|
@ -84,4 +86,23 @@ describe('List model', () => {
|
||||||
done();
|
done();
|
||||||
}, 0);
|
}, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('sends service request to update issue label', () => {
|
||||||
|
const listDup = new List(listObjDuplicate);
|
||||||
|
const issue = new ListIssue({
|
||||||
|
title: 'Testing',
|
||||||
|
iid: 1,
|
||||||
|
confidential: false,
|
||||||
|
labels: [list.label, listDup.label]
|
||||||
|
});
|
||||||
|
|
||||||
|
list.issues.push(issue);
|
||||||
|
listDup.issues.push(issue);
|
||||||
|
|
||||||
|
spyOn(gl.boardService, 'moveIssue').and.callThrough();
|
||||||
|
|
||||||
|
listDup.updateIssueLabel(list, issue);
|
||||||
|
|
||||||
|
expect(gl.boardService.moveIssue).toHaveBeenCalledWith(issue.id, list.id, listDup.id);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue