From 58f6acbc48350a1e0e4fbe2aed9015e69ace0a57 Mon Sep 17 00:00:00 2001 From: e-gaulue Date: Wed, 15 May 2024 22:17:54 +0200 Subject: [PATCH] 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. --- models/boards.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/models/boards.js b/models/boards.js index 9eb1024b0..721e24c98 100644 --- a/models/boards.js +++ b/models/boards.js @@ -640,11 +640,19 @@ Boards.attachSchema( Boards.helpers({ copy() { const oldId = this._id; + const oldWatchers = this.watchers ? this.watchers.slice() : []; delete this._id; delete this.slug; this.title = this.copyTitle(); const _id = Boards.insert(this); + // Temporary remove watchers to disable notifications + Boards.update(_id, { + $set: { + watchers: [] + }, + }); + // Copy all swimlanes in board ReactiveCache.getSwimlanes({ boardId: oldId, @@ -695,6 +703,12 @@ Boards.helpers({ rule.triggerId = triggersMap[rule.triggerId]; Rules.insert(rule); }); + + // Re-set Watchers to reenable notification + Boards.update(_id, { + $set: { watchers: oldWatchers } + }); + return _id; }, /**