Commit 058c6529 authored by Phil Hughes's avatar Phil Hughes

Fixed issue boards issue sorting when dragging issue into list

Currently it just appends the new issue to the end of list & then sorts by priority which can cause some strange effects. For example if you drag the issue to the top of the list & then vue re-renders, the issue actually goes to the bottom.
parent 00162d24
......@@ -94,7 +94,7 @@
gl.issueBoards.onStart();
},
onAdd: (e) => {
gl.issueBoards.BoardsStore.moveIssueToList(Store.moving.list, this.list, Store.moving.issue);
gl.issueBoards.BoardsStore.moveIssueToList(Store.moving.list, this.list, Store.moving.issue, e.newIndex);
this.$nextTick(() => {
e.item.remove();
......
......@@ -106,9 +106,13 @@ class List {
});
}
addIssue (issue, listFrom) {
addIssue (issue, listFrom, newIndex) {
if (!this.findIssue(issue.id)) {
this.issues.push(issue);
if (newIndex !== undefined) {
this.issues.splice(newIndex, 0, issue);
} else {
this.issues.push(issue);
}
if (this.label) {
issue.addLabel(this.label);
......
......@@ -89,14 +89,14 @@
});
listFrom.update();
},
moveIssueToList (listFrom, listTo, issue) {
moveIssueToList (listFrom, listTo, issue, newIndex) {
const issueTo = listTo.findIssue(issue.id),
issueLists = issue.getLists(),
listLabels = issueLists.map( listIssue => listIssue.label );
// Add to new lists issues if it doesn't already exist
if (!issueTo) {
listTo.addIssue(issue, listFrom);
listTo.addIssue(issue, listFrom, newIndex);
}
if (listTo.type === 'done' && listFrom.type !== 'backlog') {
......
---
title: Fixed issue boards issue sorting when dragging issue into list
merge_request:
author:
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