Change name in profile fix (#2534)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-01-24 14:07:19 +05:00 committed by GitHub
parent a5e512cea2
commit b5ca5e438b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,15 +660,13 @@ export async function changeName (db: Db, productId: string, token: string, firs
const workspaces = await db
.collection<Workspace>(WORKSPACE_COLLECTION)
.find({ _id: { $in: account.workspaces } })
.find(withProductId(productId, { _id: { $in: account.workspaces } }))
.toArray()
const promises: Promise<void>[] = []
for (const ws of workspaces) {
if (ws.productId === productId) {
promises.push(updateEmployeeAccount(account, ws.workspace, ws.productId))
}
}
await Promise.all(promises)
}