summaryrefslogtreecommitdiffstats
path: root/models/lists.js
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2019-02-25 22:48:25 +0100
committerAndrés Manelli <andresmanelli@gmail.com>2019-02-25 22:48:32 +0100
commitdc7286a0ef8111c0855129911492588ba8a384df (patch)
treedcc4f9be071a1bf55d1f2638ed63c958e0a42634 /models/lists.js
parent13c2157e36f65be4138a85fae0379e0fe31f02bd (diff)
downloadwekan-dc7286a0ef8111c0855129911492588ba8a384df.tar.gz
wekan-dc7286a0ef8111c0855129911492588ba8a384df.tar.bz2
wekan-dc7286a0ef8111c0855129911492588ba8a384df.zip
Fix list view issues. Allow creation of boards from templates
Diffstat (limited to 'models/lists.js')
-rw-r--r--models/lists.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/models/lists.js b/models/lists.js
index bf2430ee..d76c961c 100644
--- a/models/lists.js
+++ b/models/lists.js
@@ -139,20 +139,24 @@ Lists.allow({
Lists.helpers({
copy(swimlaneId) {
const oldId = this._id;
+ const oldSwimlaneId = this.swimlaneId || null;
let _id = null;
existingListWithSameName = Lists.findOne({
boardId: this.boardId,
title: this.title,
+ archived: false,
});
if (existingListWithSameName) {
_id = existingListWithSameName._id;
} else {
- this._id = null;
+ delete this._id;
+ delete this.swimlaneId;
_id = Lists.insert(this);
}
// Copy all cards in list
Cards.find({
+ swimlaneId: oldSwimlaneId,
listId: oldId,
archived: false,
}).forEach((card) => {