summaryrefslogtreecommitdiffstats
path: root/models/lists.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/lists.js')
-rw-r--r--models/lists.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/models/lists.js b/models/lists.js
index a8e597ee..1a0910c2 100644
--- a/models/lists.js
+++ b/models/lists.js
@@ -217,6 +217,10 @@ Lists.helpers({
isTemplateList() {
return this.type === 'template-list';
},
+
+ remove() {
+ Lists.remove({ _id: this._id});
+ },
});
Lists.mutations({
@@ -310,6 +314,12 @@ if (Meteor.isServer) {
});
Lists.before.remove((userId, doc) => {
+ const cards = Cards.find({ listId: doc._id });
+ if (cards) {
+ cards.forEach((card) => {
+ Cards.remove(card._id);
+ });
+ }
Activities.insert({
userId,
type: 'list',