Commit db0253cf authored by Phil Hughes's avatar Phil Hughes

Fixed bug when dragging issue to first index

The was actually stopping the issue from being added at the correct index & would instead be added to the end of the array
parent c032414b
...@@ -110,15 +110,20 @@ class List { ...@@ -110,15 +110,20 @@ class List {
} }
addIssue (issue, listFrom, newIndex) { addIssue (issue, listFrom, newIndex) {
let moveBeforeIid; let moveBeforeIid = null;
let moveAfterIid; let moveAfterIid = null;
if (!this.findIssue(issue.id)) { if (!this.findIssue(issue.id)) {
if (newIndex) { if (newIndex !== undefined) {
this.issues.splice(newIndex, 0, issue); this.issues.splice(newIndex, 0, issue);
moveBeforeIid = this.issues[newIndex - 1].id || null; if (this.issues[newIndex - 1]) {
moveAfterIid = this.issues[newIndex + 1].id || null; moveBeforeIid = this.issues[newIndex - 1].id;
}
if (this.issues[newIndex + 1]) {
moveAfterIid = this.issues[newIndex + 1].id
}
} else { } else {
this.issues.push(issue); this.issues.push(issue);
} }
......
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