From b5ca5e438bb3299518ebcfd085f44a82798f36e2 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tumanov Date: Tue, 24 Jan 2023 14:07:19 +0500 Subject: [PATCH] Change name in profile fix (#2534) Signed-off-by: Vyacheslav Tumanov --- server/account/src/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/account/src/index.ts b/server/account/src/index.ts index b537d9ac7d..f5bdbab88f 100644 --- a/server/account/src/index.ts +++ b/server/account/src/index.ts @@ -1,5 +1,5 @@ // -// Copyright © 2022 Hardcore Engineering Inc. +// Copyright © 2022-2023 Hardcore Engineering Inc. // // Licensed under the Eclipse Public License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. You may @@ -660,14 +660,12 @@ export async function changeName (db: Db, productId: string, token: string, firs const workspaces = await db .collection(WORKSPACE_COLLECTION) - .find({ _id: { $in: account.workspaces } }) + .find(withProductId(productId, { _id: { $in: account.workspaces } })) .toArray() const promises: Promise[] = [] for (const ws of workspaces) { - if (ws.productId === productId) { - promises.push(updateEmployeeAccount(account, ws.workspace, ws.productId)) - } + promises.push(updateEmployeeAccount(account, ws.workspace, ws.productId)) } await Promise.all(promises) }