Skip to content

fix(notification-trigger): seed default collaborators onto the parent doc, not the attached tx#10975

Open
MichaelUray wants to merge 1 commit into
hcengineering:developfrom
MichaelUray:fix/notification-collab-target
Open

fix(notification-trigger): seed default collaborators onto the parent doc, not the attached tx#10975
MichaelUray wants to merge 1 commit into
hcengineering:developfrom
MichaelUray:fix/notification-collab-target

Conversation

@MichaelUray

@MichaelUray MichaelUray commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes default collaborators being seeded onto an attached child document instead of the parent document whose collaborators were resolved.

In collectionCollabDoc(), doc is loaded through the child transaction's attachedTo and attachedToClass. getCollaborators() computes the defaults for that parent, but the seed path passed the child transaction's objectId, objectClass, and objectSpace to getAddCollaboratTxes().

Fix

Seed using doc._id, doc._class, and doc.space.

The returned collaborator list is unchanged; only the target of newly created Collaborator records changes.

The other two getAddCollaboratTxes() call sites in notification-resources already receive the document they operate on and remain unchanged.

Tests

Adds a focused notification-resources regression test that:

  • runs getDocCollaborators() and getAddCollaboratTxes() normally;
  • gives the parent and child distinct collaborators and spaces;
  • verifies attachedTo, attachedToClass, and objectSpace reference the parent;
  • verifies no parent-derived seed is attached to the child; and
  • verifies the returned collaborator list remains unchanged.

The test fails before the fix with attachedTo = child-item and passes after it.

Existing data

This change prevents new misplaced records. Existing records cannot be safely distinguished from legitimate child collaborators because they carry no provenance, so this PR does not attempt a data cleanup.

Related

Same wrong-target class as #10973, covering the independent notification-resources path.

… doc, not the attached tx

getCollaborators resolved the default collaborators of the parent doc (loaded via the triggering tx's attachedTo/attachedToClass) but seeded them onto tx.objectId — the attached child item (a comment/message create/update/remove tx). The parent's collaborators therefore landed on the child record instead of the parent.

Seed onto doc._id/doc._class/doc.space instead. Same class of bug as the chunter seed-target fix. The returned collaborator list is unchanged; only the target of the newly created Collaborator records changes.

Adds a unit test that drives getCollaborators directly: real getAddCollaboratTxes/getDocCollaborators, only getClassCollaborators stubbed. Parent and child are given distinct collaborators and spaces; it asserts the seed targets the parent (attachedTo/attachedToClass/objectSpace), never the child, while the returned collaborator list stays identical.

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>
@huly-github-staging

Copy link
Copy Markdown

Connected to Huly®: UBERF-16658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant