summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGhassen Rjab <rjab.ghassen@gmail.com>2017-08-31 06:58:32 +0100
committerGhassen Rjab <rjab.ghassen@gmail.com>2017-08-31 06:58:32 +0100
commita579125a1faa2ecbf3b7be535ac2ee1a2d3c5bca (patch)
treee1d19c1bb71cb0bfe26f095e7f64638f9ee52f0c
parentee938c04232ab9ac42195a35d38cb7ae11b14d48 (diff)
downloadwekan-a579125a1faa2ecbf3b7be535ac2ee1a2d3c5bca.tar.gz
wekan-a579125a1faa2ecbf3b7be535ac2ee1a2d3c5bca.tar.bz2
wekan-a579125a1faa2ecbf3b7be535ac2ee1a2d3c5bca.zip
Delete all activities related to a checklist when it is deleted
-rw-r--r--models/checklists.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/models/checklists.js b/models/checklists.js
index 59682720..2521412f 100644
--- a/models/checklists.js
+++ b/models/checklists.js
@@ -185,9 +185,11 @@ if (Meteor.isServer) {
});
Checklists.before.remove((userId, doc) => {
- const activity = Activities.findOne({ checklistId: doc._id });
- if (activity) {
- Activities.remove(activity._id);
+ const activities = Activities.find({ checklistId: doc._id });
+ if (activities) {
+ activities.forEach((activity) => {
+ Activities.remove(activity._id);
+ });
}
});
}