mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-30 21:45:01 +02:00
OnChatMessageCreated seeds a target doc's default collaborators when the doc has none yet. The seed passed the ChatMessage create tx's own identity (tx.objectId / tx.objectClass / tx.objectSpace) to getAddCollaboratTxes, so the Collaborator records were attached to the ChatMessage instead of the target doc. Two consequences: - The target doc was never actually seeded: currentCollaborators stayed empty, so the defaults were lost and the seed re-evaluated on the next message. - For provideSecurity classes the seed re-fired on every message and littered the message with Collaborator records. Pass targetDoc._id / targetDoc._class / targetDoc.space instead. This wrong-target is long-standing (pre-existing); #9217 only mechanically inherited the line and did not introduce the bug. Adds a from-scratch jest harness (chunter-resources shipped no tests). It drives ChunterTrigger with a TxCreateDoc<ChatMessage> on an empty target and asserts the seeded Collaborator attaches to the target doc (attachedTo / attachedToClass / objectSpace). getAddCollaboratTxes runs for real — only getDocCollaborators and createCollaboratorNotifications are stubbed — so the assertion exercises the actual wiring: red before the fix (attachedTo = message id), green after. A sibling of this bug lives in server-notification-resources collectionCollabDoc (the createCollabDocInfo seeding path); left out of scope here. Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com> Co-authored-by: Michael Uray <michaeluray@users.noreply.github.com>