fix: remove cal video logo from select (#17665)
* fix: remove cal video logo from managed event types * fix: do not fetch cal video logo
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { getCalVideoReference } from "@calcom/features/get-cal-video-reference";
|
||||
import { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||
import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
|
||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||
import prisma from "@calcom/prisma";
|
||||
|
||||
@@ -55,6 +56,10 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
).profile
|
||||
: null;
|
||||
|
||||
const calVideoLogo = profile?.organization
|
||||
? await OrganizationRepository.findCalVideoLogoByOrgId({ id: profile.organization.id })
|
||||
: null;
|
||||
|
||||
//daily.co calls have a 14 days exit buffer when a user enters a call when it's not available it will trigger the modals
|
||||
const now = new Date();
|
||||
const exitDate = new Date(now.getTime() - 14 * 24 * 60 * 60 * 1000);
|
||||
@@ -134,6 +139,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
: bookingObj.user,
|
||||
},
|
||||
hasTeamPlan: !!hasTeamPlan,
|
||||
calVideoLogo,
|
||||
trpcState: ssr.dehydrate(),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ export type PageProps = inferSSRProps<typeof getServerSideProps>;
|
||||
|
||||
export default function JoinCall(props: PageProps) {
|
||||
const { t } = useLocale();
|
||||
const { meetingUrl, meetingPassword, booking, hasTeamPlan } = props;
|
||||
const { meetingUrl, meetingPassword, booking, hasTeamPlan, calVideoLogo } = props;
|
||||
const [daily, setDaily] = useState<DailyCall | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -103,10 +103,10 @@ export default function JoinCall(props: PageProps) {
|
||||
<CalAiTranscribe />
|
||||
</div>
|
||||
<div style={{ zIndex: 2, position: "relative" }}>
|
||||
{booking?.user?.organization?.calVideoLogo ? (
|
||||
{calVideoLogo ? (
|
||||
<img
|
||||
className="min-w-16 min-h-16 fixed z-10 hidden aspect-square h-16 w-16 rounded-full sm:inline-block"
|
||||
src={booking.user.organization.calVideoLogo}
|
||||
src={calVideoLogo}
|
||||
alt="My Org Logo"
|
||||
style={{
|
||||
top: 32,
|
||||
|
||||
@@ -44,7 +44,6 @@ const userSelect = Prisma.validator<Prisma.UserSelect>()({
|
||||
id: true,
|
||||
name: true,
|
||||
slug: true,
|
||||
calVideoLogo: true,
|
||||
bannerUrl: true,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -298,4 +298,17 @@ export class OrganizationRepository {
|
||||
}
|
||||
return { ...org, metadata: parsedMetadata };
|
||||
}
|
||||
|
||||
static async findCalVideoLogoByOrgId({ id }: { id: number }) {
|
||||
const org = await prisma.team.findUnique({
|
||||
where: {
|
||||
id,
|
||||
},
|
||||
select: {
|
||||
calVideoLogo: true,
|
||||
},
|
||||
});
|
||||
|
||||
return org?.calVideoLogo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ const organizationSelect = {
|
||||
name: true,
|
||||
metadata: true,
|
||||
logoUrl: true,
|
||||
calVideoLogo: true,
|
||||
bannerUrl: true,
|
||||
isPlatform: true,
|
||||
};
|
||||
@@ -363,7 +362,6 @@ export class ProfileRepository {
|
||||
},
|
||||
organization: {
|
||||
select: {
|
||||
calVideoLogo: true,
|
||||
id: true,
|
||||
logoUrl: true,
|
||||
name: true,
|
||||
|
||||
@@ -465,7 +465,7 @@ export class UserRepository {
|
||||
organization?: {
|
||||
id: number;
|
||||
name: string;
|
||||
calVideoLogo: string | null;
|
||||
calVideoLogo?: string | null;
|
||||
bannerUrl: string | null;
|
||||
slug: string | null;
|
||||
metadata: Prisma.JsonValue;
|
||||
|
||||
@@ -207,16 +207,6 @@ const filterEventTypes = async (
|
||||
evType.hosts = [];
|
||||
});
|
||||
|
||||
// Remove calVideoLogo from organization objects
|
||||
filteredEventTypes.forEach((eventType) => {
|
||||
eventType.users?.forEach((user) => {
|
||||
if (user.profile?.organization) {
|
||||
const { calVideoLogo, ...orgWithoutCalVideoLogo } = user.profile.organization;
|
||||
user.profile.organization = orgWithoutCalVideoLogo;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
log.info(
|
||||
"filteredEventTypes",
|
||||
safeStringify({
|
||||
|
||||
Reference in New Issue
Block a user