summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/boards/models
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-02-13 09:42:09 +0000
committerPhil Hughes <me@iamphill.com>2017-02-17 11:29:16 +0000
commitdb0253cf443cb685859b4518040ee307ff8a446a (patch)
treeb3f1bad96fc6e1544ac019b1172d5307854db26f /app/assets/javascripts/boards/models
parentc032414b2d7b6ba75c3b202fe8791e32a0eb09e1 (diff)
downloadgitlab-ce-db0253cf443cb685859b4518040ee307ff8a446a.tar.gz
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.es615
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);
}