mirror of
https://github.com/wekan/wekan.git
synced 2026-01-07 01:58:49 +01:00
remove feature
This commit is contained in:
parent
6933424fca
commit
8137f2692f
10 changed files with 135 additions and 14 deletions
|
|
@ -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')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue