From ea5e5644284ef94243144f0f31f4f1c430d8dd8d Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 7 Mar 2023 09:45:39 +0000 Subject: [PATCH] fix tenant filtering issue --- packages/frontend-core/src/api/user.js | 3 +-- packages/worker/src/utilities/redis.ts | 9 +-------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/packages/frontend-core/src/api/user.js b/packages/frontend-core/src/api/user.js index cb8a8f6555..d8723a649c 100644 --- a/packages/frontend-core/src/api/user.js +++ b/packages/frontend-core/src/api/user.js @@ -194,8 +194,7 @@ export const buildUserEndpoints = API => ({ }, /** - * Retrieves the invitation associated with a provided code. - * @param code The unique code for the target invite + * Retrieves all user invitations for the current tenant. */ getUserInvites: async () => { return await API.get({ diff --git a/packages/worker/src/utilities/redis.ts b/packages/worker/src/utilities/redis.ts index 7b3f251c0e..ecafee649b 100644 --- a/packages/worker/src/utilities/redis.ts +++ b/packages/worker/src/utilities/redis.ts @@ -142,12 +142,5 @@ export async function getInviteCodes(tenantIds?: string[]) { code: invite.key, } }) - return results.reduce((acc, invite) => { - if (tenantIds?.length && tenantIds.includes(invite.info.tenantId)) { - acc.push(invite) - } else { - acc.push(invite) - } - return acc - }, []) + return results.filter(invite => tenantIds?.length && tenantIds.includes(invite.info.tenantId)) }