From b37c11962868e4e7ee5bab54e9c116e4805b4143 Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Tue, 25 Mar 2025 13:48:28 +0400 Subject: [PATCH] uberf-9691: expose full social ids in own account (#8340) Signed-off-by: Alexey Zinoviev --- packages/core/src/classes.ts | 1 + packages/core/src/component.ts | 3 ++- plugins/guest-resources/src/connect.ts | 3 ++- plugins/workbench-resources/src/connect.ts | 3 ++- server/server/src/sessionManager.ts | 9 ++++++--- .../ai-bot/pod-ai-bot/src/workspace/workspaceClient.ts | 3 ++- ws-tests/api-tests/src/__tests__/rest.test.ts | 6 ++++-- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/packages/core/src/classes.ts b/packages/core/src/classes.ts index d8c1bb7ac2..932aa48d96 100644 --- a/packages/core/src/classes.ts +++ b/packages/core/src/classes.ts @@ -74,6 +74,7 @@ export interface Account { role: AccountRole primarySocialId: PersonId socialIds: PersonId[] + fullSocialIds: SocialId[] } /** diff --git a/packages/core/src/component.ts b/packages/core/src/component.ts index 4e27228c1c..3dad7ffa74 100644 --- a/packages/core/src/component.ts +++ b/packages/core/src/component.ts @@ -90,7 +90,8 @@ export const systemAccount: Account = { uuid: systemAccountUuid, role: AccountRole.Owner, primarySocialId: '' as PersonId, - socialIds: [] + socialIds: [], + fullSocialIds: [] } export const configUserAccountUuid = '0d94731c-0787-4bcd-aefe-304efc3706b1' as AccountUuid diff --git a/plugins/guest-resources/src/connect.ts b/plugins/guest-resources/src/connect.ts index 307be974c5..b7d474eb5d 100644 --- a/plugins/guest-resources/src/connect.ts +++ b/plugins/guest-resources/src/connect.ts @@ -185,7 +185,8 @@ export async function connect (title: string): Promise { uuid: account, role: workspaceLoginInfo.role, primarySocialId: '' as PersonId, - socialIds: [] + socialIds: [], + fullSocialIds: [] } if (me !== undefined) { diff --git a/plugins/workbench-resources/src/connect.ts b/plugins/workbench-resources/src/connect.ts index 0cacf9c088..db4edc5b95 100644 --- a/plugins/workbench-resources/src/connect.ts +++ b/plugins/workbench-resources/src/connect.ts @@ -348,7 +348,8 @@ export async function connect (title: string): Promise { uuid: account, role: workspaceLoginInfo.role, primarySocialId: pickPrimarySocialId(socialIds)._id, - socialIds: socialIds.map((si) => si._id) + socialIds: socialIds.map((si) => si._id), + fullSocialIds: socialIds } // Ensure employee and social identifiers diff --git a/server/server/src/sessionManager.ts b/server/server/src/sessionManager.ts index 9796ea9562..7d1e6b1bca 100644 --- a/server/server/src/sessionManager.ts +++ b/server/server/src/sessionManager.ts @@ -339,7 +339,8 @@ export class TSessionManager implements SessionManager { uuid: loginInfo.account, role: loginInfo.role, primarySocialId: '' as PersonId, - socialIds: [] + socialIds: [], + fullSocialIds: [] } } @@ -348,7 +349,8 @@ export class TSessionManager implements SessionManager { uuid: loginInfo.account, role: loginInfo.role, primarySocialId: core.account.System, - socialIds: [] + socialIds: [core.account.System], + fullSocialIds: [] } } @@ -358,7 +360,8 @@ export class TSessionManager implements SessionManager { uuid: loginInfo.account, role: loginInfo.role, primarySocialId: pickPrimarySocialId(socialIds)._id, - socialIds: socialIds.map((si) => si._id) + socialIds: socialIds.map((si) => si._id), + fullSocialIds: socialIds } } catch (err: any) { if (err?.cause?.code === 'ECONNRESET' || err?.cause?.code === 'ECONNREFUSED') { diff --git a/services/ai-bot/pod-ai-bot/src/workspace/workspaceClient.ts b/services/ai-bot/pod-ai-bot/src/workspace/workspaceClient.ts index 12ddb66311..8f41040d9d 100644 --- a/services/ai-bot/pod-ai-bot/src/workspace/workspaceClient.ts +++ b/services/ai-bot/pod-ai-bot/src/workspace/workspaceClient.ts @@ -111,7 +111,8 @@ export class WorkspaceClient { uuid: this.personUuid, role: AccountRole.User, primarySocialId: this.primarySocialId._id, - socialIds: this.socialIds.map((it) => it._id) + socialIds: this.socialIds.map((it) => it._id), + fullSocialIds: this.socialIds } await ensureEmployee(this.ctx, me, client, this.socialIds, async () => await getGlobalPerson(this.token)) } diff --git a/ws-tests/api-tests/src/__tests__/rest.test.ts b/ws-tests/api-tests/src/__tests__/rest.test.ts index b29215113e..5d85677f29 100644 --- a/ws-tests/api-tests/src/__tests__/rest.test.ts +++ b/ws-tests/api-tests/src/__tests__/rest.test.ts @@ -78,7 +78,8 @@ describe('rest-api-server', () => { uuid: apiWorkspace1.info.account, role: apiWorkspace1.info.role, primarySocialId: pickPrimarySocialId(socialIds)._id, - socialIds: socialIds.map((si) => si._id) + socialIds: socialIds.map((si) => si._id), + fullSocialIds: socialIds }, connect(), socialIds, @@ -91,7 +92,8 @@ describe('rest-api-server', () => { uuid: apiWorkspace2.info.account, role: apiWorkspace2.info.role, primarySocialId: pickPrimarySocialId(socialIds)._id, - socialIds: socialIds.map((si) => si._id) + socialIds: socialIds.map((si) => si._id), + fullSocialIds: socialIds }, connect(apiWorkspace2), socialIds,