From da9f0995c8d7d853d224957721facf2098e5877b Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Tue, 8 Aug 2023 21:17:48 +0700 Subject: [PATCH] UBER-710: Fix preference notifications (#3574) Signed-off-by: Andrey Sobolev --- server/middleware/src/private.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/middleware/src/private.ts b/server/middleware/src/private.ts index c6c00131c38..0314b6fe006 100644 --- a/server/middleware/src/private.ts +++ b/server/middleware/src/private.ts @@ -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)