mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-15 13:55:20 +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
|
}, /* 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 () => {
|
export const getRepoImage = async (repoId: number): Promise<ArrayBuffer | ServiceError> => sew(async () => {
|
||||||
return await withOptionalAuthV2(async ({ org, prisma }) => {
|
return await withOptionalAuthV2(async ({ org, prisma }) => {
|
||||||
const repo = await prisma.repo.findUnique({
|
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
|
// the entitlement, synced search contexts, and then no longer had the entitlement
|
||||||
const hasSearchContextEntitlement = hasEntitlement("search-contexts")
|
const hasSearchContextEntitlement = hasEntitlement("search-contexts")
|
||||||
if(!hasSearchContextEntitlement) {
|
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
|
// Sync anonymous access config from the config file
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue