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 @@ ...@@ -94,7 +94,7 @@
gl.issueBoards.onStart(); gl.issueBoards.onStart();
}, },
onAdd: (e) => { 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(() => { this.$nextTick(() => {
e.item.remove(); e.item.remove();
......
...@@ -106,9 +106,13 @@ class List { ...@@ -106,9 +106,13 @@ class List {
}); });
} }
addIssue (issue, listFrom) { addIssue (issue, listFrom, newIndex) {
if (!this.findIssue(issue.id)) { if (!this.findIssue(issue.id)) {
if (newIndex !== undefined) {
this.issues.splice(newIndex, 0, issue);
} else {
this.issues.push(issue); this.issues.push(issue);
}
if (this.label) { if (this.label) {
issue.addLabel(this.label); issue.addLabel(this.label);
......
...@@ -89,14 +89,14 @@ ...@@ -89,14 +89,14 @@
}); });
listFrom.update(); listFrom.update();
}, },
moveIssueToList (listFrom, listTo, issue) { moveIssueToList (listFrom, listTo, issue, newIndex) {
const issueTo = listTo.findIssue(issue.id), const issueTo = listTo.findIssue(issue.id),
issueLists = issue.getLists(), issueLists = issue.getLists(),
listLabels = issueLists.map( listIssue => listIssue.label ); listLabels = issueLists.map( listIssue => listIssue.label );
// Add to new lists issues if it doesn't already exist // Add to new lists issues if it doesn't already exist
if (!issueTo) { if (!issueTo) {
listTo.addIssue(issue, listFrom); listTo.addIssue(issue, listFrom, newIndex);
} }
if (listTo.type === 'done' && listFrom.type !== 'backlog') { 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