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) }