diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-04-23 19:30:23 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-04-23 19:30:23 +0300 |
commit | 11e8a9d5c421609e9ec6bc30ae1c9fe48d6460a1 (patch) | |
tree | a054ec502113381363254b8d386de05bfd1626e4 /models/boards.js | |
parent | 6933424fca56fc84b0060ff97b97303d36ab5fb0 (diff) | |
parent | 8137f2692fe3e1d9f1c0a9b635ef15cdf36728f7 (diff) | |
download | wekan-11e8a9d5c421609e9ec6bc30ae1c9fe48d6460a1.tar.gz wekan-11e8a9d5c421609e9ec6bc30ae1c9fe48d6460a1.tar.bz2 wekan-11e8a9d5c421609e9ec6bc30ae1c9fe48d6460a1.zip |
Merge branch 'Akuket-feature/removeArchived' into edge
Diffstat (limited to 'models/boards.js')
-rw-r--r-- | models/boards.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/models/boards.js b/models/boards.js index 36651d54..b07d9e27 100644 --- a/models/boards.js +++ b/models/boards.js @@ -803,6 +803,13 @@ Boards.mutations({ }, }); +function boardRemover(userId, doc) { + [Cards, Lists, Swimlanes, Integrations, Rules, Activities].forEach((element) => { + element.remove({ boardId: doc._id }); + }); +} + + if (Meteor.isServer) { Boards.allow({ insert: Meteor.userId, @@ -966,6 +973,18 @@ if (Meteor.isServer) { } }); + Boards.before.remove((userId, doc) => { + boardRemover(userId, doc); + // Add removeBoard activity to keep it + Activities.insert({ + userId, + type: 'board', + activityTypeId: doc._id, + activityType: 'removeBoard', + boardId: doc._id, + }); + }); + // Add a new activity if we add or remove a member to the board Boards.after.update((userId, doc, fieldNames, modifier) => { if (!_.contains(fieldNames, 'members')) { |