From 6247f686e856ede660e93032c0a7f9f132ad3e3f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 21 Sep 2022 23:12:38 +0100 Subject: [PATCH] Adding group app cleanup. --- packages/builder/src/stores/portal/groups.js | 2 ++ packages/server/src/api/controllers/application.ts | 10 +++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/stores/portal/groups.js b/packages/builder/src/stores/portal/groups.js index 656b77f082..66a3ded54e 100644 --- a/packages/builder/src/stores/portal/groups.js +++ b/packages/builder/src/stores/portal/groups.js @@ -67,11 +67,13 @@ export function createGroupsStore() { addApp: async (groupId, appId, roleId) => { await API.addAppsToGroup(groupId, [{ appId, roleId }]) + // refresh the group roles await getGroup(groupId) }, removeApp: async (groupId, appId) => { await API.removeAppsFromGroup(groupId, [{ appId }]) + // refresh the group roles await getGroup(groupId) }, } diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index a9cf1a834d..8d95407268 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -47,14 +47,9 @@ import { checkAppMetadata } from "../../automations/logging" import { getUniqueRows } from "../../utilities/usageQuota/rows" import { quotas } from "@budibase/pro" import { errors, events, migrations } from "@budibase/backend-core" -import { - App, - Layout, - Screen, - MigrationType, - AppNavigation, -} from "@budibase/types" +import { App, Layout, Screen, MigrationType } from "@budibase/types" import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts" +import { groups } from "@budibase/pro" const URL_REGEX_SLASH = /\/|\\/g @@ -501,6 +496,7 @@ const preDestroyApp = async (ctx: any) => { const postDestroyApp = async (ctx: any) => { const rowCount = ctx.rowCount + await groups.cleanupApp(ctx.params.appId) if (rowCount) { await quotas.removeRows(rowCount) }