Fix list view issues. Allow creation of boards from templates

This commit is contained in:
Andrés Manelli 2019-02-25 22:48:25 +01:00
parent 13c2157e36
commit dc7286a0ef
12 changed files with 122 additions and 35 deletions

View file

@ -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) => {