UBER-710: Fix preference notifications (#3574)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2023-08-08 21:17:48 +07:00 committed by GitHub
parent 50b19ad538
commit 6ef7d36fd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,11 @@ export class PrivateMiddleware extends BaseMiddleware implements Middleware {
if (account !== tx.modifiedBy && account !== core.account.System) {
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
}
const modifiedByAccount = await this.storage.modelDb.findAll(core.class.Account, { _id: tx.modifiedBy })
target = [ctx.userEmail, systemAccountEmail]
if (modifiedByAccount.length > 0 && !target.includes(modifiedByAccount[0].email)) {
target.push(modifiedByAccount[0].email)
}
}
}
const res = await this.provideTx(ctx, tx)