From 945f0a282fb3ff600ba0bac084a883ca4ae56f4c Mon Sep 17 00:00:00 2001 From: msukkari Date: Thu, 13 Nov 2025 21:12:56 -0800 Subject: [PATCH] simplify --- packages/web/src/actions.ts | 16 ---------------- packages/web/src/initialize.ts | 6 +++++- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/packages/web/src/actions.ts b/packages/web/src/actions.ts index 16ce61a5..e194f808 100644 --- a/packages/web/src/actions.ts +++ b/packages/web/src/actions.ts @@ -1669,22 +1669,6 @@ export const getSearchContexts = async (domain: string) => sew(() => }, /* minRequiredRole = */ OrgRole.GUEST), /* allowAnonymousAccess = */ true )); -export const clearSearchContexts = async (domain: string) => sew(() => - withAuth((userId) => - withOrgMembership(userId, domain, async ({ org }) => { - await prisma.searchContext.deleteMany({ - where: { - orgId: org.id, - }, - }); - - return { - success: true, - }; - }, /* minRequiredRole = */ OrgRole.OWNER) - ) -) - export const getRepoImage = async (repoId: number): Promise => sew(async () => { return await withOptionalAuthV2(async ({ org, prisma }) => { const repo = await prisma.repo.findUnique({ diff --git a/packages/web/src/initialize.ts b/packages/web/src/initialize.ts index bd598ec5..cf2fbdc4 100644 --- a/packages/web/src/initialize.ts +++ b/packages/web/src/initialize.ts @@ -68,7 +68,11 @@ const initSingleTenancy = async () => { // the entitlement, synced search contexts, and then no longer had the entitlement const hasSearchContextEntitlement = hasEntitlement("search-contexts") if(!hasSearchContextEntitlement) { - clearSearchContexts(SINGLE_TENANT_ORG_DOMAIN) + await prisma.searchContext.deleteMany({ + where: { + orgId: SINGLE_TENANT_ORG_ID, + }, + }); } // Sync anonymous access config from the config file