mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-13 04:45:19 +00:00
simplify
This commit is contained in:
parent
29659031ad
commit
945f0a282f
2 changed files with 5 additions and 17 deletions
|
|
@ -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<ArrayBuffer | ServiceError> => sew(async () => {
|
||||
return await withOptionalAuthV2(async ({ org, prisma }) => {
|
||||
const repo = await prisma.repo.findUnique({
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue