From e2a45900d4056b5311d95bed89d28a3c3cc15fae Mon Sep 17 00:00:00 2001 From: Kristina Fefelova Date: Wed, 1 Oct 2025 09:33:21 +0400 Subject: [PATCH] Do not add collabs on mentions whrn security enabled Signed-off-by: Kristina Fefelova --- server-plugins/chunter-resources/src/index.ts | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/server-plugins/chunter-resources/src/index.ts b/server-plugins/chunter-resources/src/index.ts index 14478bd2ded..dbb067aacf6 100644 --- a/server-plugins/chunter-resources/src/index.ts +++ b/server-plugins/chunter-resources/src/index.ts @@ -207,19 +207,24 @@ async function OnChatMessageCreated (ctx: MeasureContext, tx: TxCUD, contro } } - for (const collab of collaboratorsFromMessage) { - if (currentCollaborators.includes(collab)) { - continue - } + const classCollab = ( + await control.findAll(control.ctx, core.class.ClassCollaborators, { attachedTo: targetDoc._class }) + )[0] + if (classCollab?.provideSecurity !== true) { + for (const collab of collaboratorsFromMessage) { + if (currentCollaborators.includes(collab)) { + continue + } - const tx = control.txFactory.createTxCreateDoc(core.class.Collaborator, targetDoc.space, { - attachedTo: targetDoc._id, - attachedToClass: targetDoc._class, - collaborator: collab, - collection: 'collaborators' - }) + const tx = control.txFactory.createTxCreateDoc(core.class.Collaborator, targetDoc.space, { + attachedTo: targetDoc._id, + attachedToClass: targetDoc._class, + collaborator: collab, + collection: 'collaborators' + }) - res.push(tx) + res.push(tx) + } } if (account != null && isChannel && !(targetDoc as Channel).members.includes(account)) {