Skip to content

Commit

Permalink
Fix proper target for derived transactions
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <[email protected]>
  • Loading branch information
haiodo committed Jul 19, 2024
1 parent 24cbce0 commit 03829b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions server-plugins/notification-resources/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,11 @@ export async function pushInboxNotifications (
lastUpdateTimestamp: shouldUpdateTimestamp ? modifiedOn : undefined
})
await control.apply([createContextTx])
control.operationContext.derived.targets['docNotifyContext' + createContextTx._id] = (it) => {
if (it._id === createContextTx._id) {
return [account.email]
if (target.account?.email !== undefined) {
control.operationContext.derived.targets['docNotifyContext' + createContextTx._id] = (it) => {
if (it._id === createContextTx._id) {
return [target.account?.email as string]
}
}
}
docNotifyContextId = createContextTx.objectId
Expand All @@ -375,12 +377,15 @@ export async function pushInboxNotifications (
lastUpdateTimestamp: modifiedOn
})
await control.apply([updateTx])
control.operationContext.derived.targets['docNotifyContext' + updateTx._id] = (it) => {
if (it._id === updateTx._id) {
return [account.email]
if (target.account?.email !== undefined) {
control.operationContext.derived.targets['docNotifyContext' + updateTx._id] = (it) => {
if (it._id === updateTx._id) {
return [target.account?.email as string]
}
}
}
}

docNotifyContextId = context._id
}

Expand Down Expand Up @@ -817,7 +822,7 @@ export async function createCollabDocInfo (
notifyContexts,
docMessages
)
const ids = new Set(res.map((it) => it._id))
const ids = new Set(targetRes.map((it) => it._id))
if (info.account?.email !== undefined) {
const id = generateId() as string
control.operationContext.derived.targets[id] = (it) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"uitest": "cross-env LOCAL_URL=http://localhost:3003/ DEV_URL= playwright test -c ./tests/playwright.config.ts",
"staging-uitest": "cross-env PLATFORM_URI=https://front.hc.engineering/ playwright test -c ./tests/playwright.config.ts --grep @staging",
"dev-uitest": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://localhost:3333 SETTING=storage-dev.json SETTING_SECOND=storageSecond-dev.json DEV_URL=http://localhost:8080/account playwright test -c ./tests/playwright.config.ts",
"debug": "playwright test -c ./tests/playwright.config.ts --debug --headed",
"debug": "cross-env LOCAL_URL=http://localhost:3003/ DEV_URL= playwright test -c ./tests/playwright.config.ts --debug --headed",
"dev-debug": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://localhost:3333 SETTING=storage-dev.json SETTING_SECOND=storageSecond-dev.json playwright test -c ./tests/playwright.config.ts --debug --headed",
"codegen": "playwright codegen --load-storage storage.json http://localhost:8083/workbench/sanity-ws/",
"dev-codegen": "cross-env playwright codegen --load-storage storage-dev.json http://localhost:8080/workbench/sanity-ws/",
Expand Down

0 comments on commit 03829b9

Please sign in to comment.