diff options
author | Phil Hughes <me@iamphill.com> | 2017-02-13 12:42:09 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-02-17 14:29:16 +0300 |
commit | db0253cf443cb685859b4518040ee307ff8a446a (patch) | |
tree | b3f1bad96fc6e1544ac019b1172d5307854db26f /app/assets/javascripts/boards/models | |
parent | c032414b2d7b6ba75c3b202fe8791e32a0eb09e1 (diff) |
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
Diffstat (limited to 'app/assets/javascripts/boards/models')
-rw-r--r-- | app/assets/javascripts/boards/models/list.js.es6 | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/app/assets/javascripts/boards/models/list.js.es6 b/app/assets/javascripts/boards/models/list.js.es6 index a07fac380f7..dc815d2f815 100644 --- a/app/assets/javascripts/boards/models/list.js.es6 +++ b/app/assets/javascripts/boards/models/list.js.es6 @@ -110,15 +110,20 @@ class List { } addIssue (issue, listFrom, newIndex) { - let moveBeforeIid; - let moveAfterIid; + let moveBeforeIid = null; + let moveAfterIid = null; if (!this.findIssue(issue.id)) { - if (newIndex) { + if (newIndex !== undefined) { this.issues.splice(newIndex, 0, issue); - moveBeforeIid = this.issues[newIndex - 1].id || null; - moveAfterIid = this.issues[newIndex + 1].id || null; + if (this.issues[newIndex - 1]) { + moveBeforeIid = this.issues[newIndex - 1].id; + } + + if (this.issues[newIndex + 1]) { + moveAfterIid = this.issues[newIndex + 1].id + } } else { this.issues.push(issue); } |