diff options
Diffstat (limited to 'models/lists.js')
-rw-r--r-- | models/lists.js | 6 |
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) => { |