feature: Allow non-calcom domains to run team slug pages (#18711)
This commit is contained in:
1 parent
1d449ecc6b
commit
b7f7c33afc
4 files changed
+52
-45
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import type { OrganizationSettings } from "@calcom/prisma/client";
|
||||
|
||||
type MinimumOrganizationSettings = Pick<
|
||||
OrganizationSettings,
|
||||
"orgAutoAcceptEmail" | "orgProfileRedirectsToVerifiedDomain" | "allowSEOIndexing"
|
||||
>;
|
||||
|
||||
type SEOOrganizationSettings = Pick<OrganizationSettings, "allowSEOIndexing">;
|
||||
|
||||
export const getOrganizationSettings = (team: {
|
||||
isOrganization: boolean;
|
||||
organizationSettings: MinimumOrganizationSettings | null;
|
||||
parent: {
|
||||
organizationSettings: MinimumOrganizationSettings | null;
|
||||
} | null;
|
||||
}) => {
|
||||
if (!team) return null;
|
||||
if (team.isOrganization) return team.organizationSettings ?? null;
|
||||
if (!team.parent) return null;
|
||||
return team.parent.organizationSettings ?? null;
|
||||
};
|
||||
|
||||
export const getOrganizationSEOSettings = (team: {
|
||||
isOrganization: boolean;
|
||||
organizationSettings: SEOOrganizationSettings | null;
|
||||
parent: {
|
||||
organizationSettings: SEOOrganizationSettings | null;
|
||||
} | null;
|
||||
}) => {
|
||||
if (!team) return null;
|
||||
if (team.isOrganization) return team.organizationSettings ?? null;
|
||||
if (!team.parent) return null;
|
||||
return team.parent.organizationSettings ?? null;
|
||||
};
|
||||
|
||||
export const getVerifiedDomain = (settings: Pick<OrganizationSettings, "orgAutoAcceptEmail">) => {
|
||||
return settings.orgAutoAcceptEmail;
|
||||
};
|
||||
@@ -3,7 +3,6 @@ import { IS_TEAM_BILLING_ENABLED } from "@calcom/lib/constants";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import type { OrganizationSettings } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
@@ -11,11 +10,6 @@ import { createAProfileForAnExistingUser } from "../../createAProfileForAnExisti
|
||||
import { getParsedTeam } from "./teamUtils";
|
||||
import { UserRepository } from "./user";
|
||||
|
||||
type MinimumOrganizationSettings = Pick<
|
||||
OrganizationSettings,
|
||||
"orgAutoAcceptEmail" | "orgProfileRedirectsToVerifiedDomain" | "allowSEOIndexing"
|
||||
>;
|
||||
type SEOOrganizationSettings = Pick<OrganizationSettings, "allowSEOIndexing">;
|
||||
const orgSelect = {
|
||||
id: true,
|
||||
name: true,
|
||||
@@ -356,38 +350,4 @@ export class OrganizationRepository {
|
||||
|
||||
return org?.calVideoLogo;
|
||||
}
|
||||
|
||||
static utils = {
|
||||
/**
|
||||
* Gets the organization setting if the team is an organization.
|
||||
* If not, it gets the organization setting of the parent organization.
|
||||
*/
|
||||
getOrganizationSettings: (team: {
|
||||
isOrganization: boolean;
|
||||
organizationSettings: MinimumOrganizationSettings | null;
|
||||
parent: {
|
||||
organizationSettings: MinimumOrganizationSettings | null;
|
||||
} | null;
|
||||
}) => {
|
||||
if (!team) return null;
|
||||
if (team.isOrganization) return team.organizationSettings ?? null;
|
||||
if (!team.parent) return null;
|
||||
return team.parent.organizationSettings ?? null;
|
||||
},
|
||||
getOrganizationSEOSettings: (team: {
|
||||
isOrganization: boolean;
|
||||
organizationSettings: SEOOrganizationSettings | null;
|
||||
parent: {
|
||||
organizationSettings: SEOOrganizationSettings | null;
|
||||
} | null;
|
||||
}) => {
|
||||
if (!team) return null;
|
||||
if (team.isOrganization) return team.organizationSettings ?? null;
|
||||
if (!team.parent) return null;
|
||||
return team.parent.organizationSettings ?? null;
|
||||
},
|
||||
getVerifiedDomain(settings: Pick<OrganizationSettings, "orgAutoAcceptEmail">) {
|
||||
return settings.orgAutoAcceptEmail;
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user