From 06486ab11afdae08fc9fa8d78080b47a9345cc52 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 26 Sep 2022 14:50:31 +0100 Subject: [PATCH] Fix multiple issues with groups UI due to not correctly accounting for multi-tenant app ID structuer --- .../src/pages/builder/portal/manage/groups/[groupId].svelte | 6 +++--- .../portal/overview/_components/AssignmentModal.svelte | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte index b0ff17cc53..23cdbff877 100644 --- a/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte +++ b/packages/builder/src/pages/builder/portal/manage/groups/[groupId].svelte @@ -42,7 +42,7 @@ $: group = $groups.find(x => x._id === groupId) $: filtered = $users.data $: groupApps = $apps.filter(app => - groups.actions.getGroupAppIds(group).includes(`app_${app.appId}`) + groups.actions.getGroupAppIds(group).includes(apps.getProdAppID(app.appId)) ) $: { if (loaded && !group?._id) { @@ -70,7 +70,7 @@ } const getRoleLabel = appId => { - const roleId = group?.roles?.[`app_${appId}`] + const roleId = group?.roles?.[apps.getProdAppID(appId)] const role = $roles.find(x => x._id === roleId) return role?.name || "Custom role" } @@ -197,7 +197,7 @@ {getRoleLabel(app.appId)} diff --git a/packages/builder/src/pages/builder/portal/overview/_components/AssignmentModal.svelte b/packages/builder/src/pages/builder/portal/overview/_components/AssignmentModal.svelte index 220242f2c9..0cb8085bb0 100644 --- a/packages/builder/src/pages/builder/portal/overview/_components/AssignmentModal.svelte +++ b/packages/builder/src/pages/builder/portal/overview/_components/AssignmentModal.svelte @@ -39,7 +39,6 @@ $: fixedAppId = apps.getProdAppID(app.devId) $: availableUsers = getAvailableUsers($usersFetch.rows, appUsers, data) $: availableGroups = getAvailableGroups($groups, app.appId, search, data) - $: console.log(availableGroups) $: valid = data?.length && !data?.some(x => !x.id?.length || !x.role?.length) $: optionSections = { ...($licensing.groupsEnabled && @@ -115,7 +114,7 @@ return (allGroups || []).filter(group => { // Filter out assigned groups const appIds = groups.actions.getGroupAppIds(group) - if (appIds.includes(`app_${appId}`)) { + if (appIds.includes(apps.getProdAppID(appId))) { return false }