Remove notification while copying board

1. It takes too long while server stops after 2 minutes (#5371).
2. It is useless, because when you copy a board, most of the time your users don't want to be notified of every copied cards.
This commit is contained in:
e-gaulue 2024-05-15 22:17:54 +02:00 committed by GitHub
parent db73fb4e37
commit 58f6acbc48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -640,11 +640,19 @@ Boards.attachSchema(
Boards.helpers({ Boards.helpers({
copy() { copy() {
const oldId = this._id; const oldId = this._id;
const oldWatchers = this.watchers ? this.watchers.slice() : [];
delete this._id; delete this._id;
delete this.slug; delete this.slug;
this.title = this.copyTitle(); this.title = this.copyTitle();
const _id = Boards.insert(this); const _id = Boards.insert(this);
// Temporary remove watchers to disable notifications
Boards.update(_id, {
$set: {
watchers: []
},
});
// Copy all swimlanes in board // Copy all swimlanes in board
ReactiveCache.getSwimlanes({ ReactiveCache.getSwimlanes({
boardId: oldId, boardId: oldId,
@ -695,6 +703,12 @@ Boards.helpers({
rule.triggerId = triggersMap[rule.triggerId]; rule.triggerId = triggersMap[rule.triggerId];
Rules.insert(rule); Rules.insert(rule);
}); });
// Re-set Watchers to reenable notification
Boards.update(_id, {
$set: { watchers: oldWatchers }
});
return _id; return _id;
}, },
/** /**