Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/web/components/dialog/EditLocationDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ export const EditLocationDialog = (props: ISetLocationDialog) => {
id="locationInput"
placeholder={t(eventLocationType.organizerInputPlaceholder || "")}
required
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
defaultValue={
defaultLocation ? defaultLocation[eventLocationType.defaultValueVariable] : undefined
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { orgDomainConfig } from "@calcom/ee/organizations/lib/orgDomains";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import getBookingInfo from "@calcom/features/bookings/lib/getBookingInfo";
import { BookingRepository } from "@calcom/features/bookings/repositories/BookingRepository";
import { isTeamMember } from "@calcom/features/ee/teams/lib/queries";
import { getDefaultEvent } from "@calcom/features/eventtypes/lib/defaultEvents";
import { getBrandingForEventType } from "@calcom/features/profile/lib/getBranding";
import { shouldHideBrandingForEvent } from "@calcom/features/profile/lib/hideBranding";
Expand Down Expand Up @@ -183,6 +184,10 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
};

const isLoggedInUserHost = checkIfUserIsHost(userId);
const eventTeamId = eventType.team?.id ?? eventType.parent?.teamId;
const isLoggedInUserTeamMember = !!(userId && eventTeamId && (await isTeamMember(userId, eventTeamId)));

const canViewHiddenData = isLoggedInUserHost || isLoggedInUserTeamMember;

if (bookingInfo !== null && eventType.seatsPerTimeSlot) {
await handleSeatsEventTypeOnBooking(eventType, bookingInfo, seatReferenceUid, isLoggedInUserHost);
Expand All @@ -202,8 +207,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
},
});

if (!isLoggedInUserHost) {
// Removing hidden fields from responses
if (!canViewHiddenData) {
for (const key in bookingInfo.responses) {
const field = eventTypeRaw.bookingFields.find((field) => field.name === key);
if (field && !!field.hidden) {
Expand All @@ -215,7 +219,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
const { currentOrgDomain } = orgDomainConfig(context.req);

async function getInternalNotePresets(teamId: number | null) {
if (!teamId || !isLoggedInUserHost) return [];
if (!teamId || !canViewHiddenData) return [];
return await prisma.internalNotePreset.findMany({
where: {
teamId,
Expand All @@ -233,8 +237,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
// Filter out organizer information if hideOrganizerEmail is true
const sanitizedPreviousBooking =
eventType.hideOrganizerEmail &&
previousBooking &&
previousBooking.rescheduledBy === bookingInfo.user?.email
previousBooking &&
previousBooking.rescheduledBy === bookingInfo.user?.email
? { ...previousBooking, rescheduledBy: bookingInfo.user?.name }
: previousBooking;

Expand All @@ -247,11 +251,11 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
hideBranding: isPlatformBooking
? true
: await shouldHideBrandingForEvent({
eventTypeId: eventType.id,
team: eventType?.parent?.team ?? eventType?.team,
owner: eventType.users[0] ?? null,
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
}),
eventTypeId: eventType.id,
team: eventType?.parent?.team ?? eventType?.team,
owner: eventType.users[0] ?? null,
organizationId: session?.user?.profile?.organizationId ?? session?.user?.org?.id ?? null,
}),
profile,
eventType,
recurringBookings: await getRecurringBookings(bookingInfo.recurringEventId),
Expand All @@ -264,6 +268,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
requiresLoginToUpdate,
rescheduledToUid,
isLoggedInUserHost,
canViewHiddenData,
internalNotePresets: internalNotes,
},
};
Expand Down
23 changes: 14 additions & 9 deletions apps/web/modules/bookings/views/bookings-single-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,14 @@ export default function Success(props: PageProps) {
const pathname = usePathname();
const searchParams = useCompatSearchParams();

const { eventType, bookingInfo, previousBooking, requiresLoginToUpdate, rescheduledToUid } = props;
const {
eventType,
bookingInfo,
previousBooking,
requiresLoginToUpdate,
rescheduledToUid,
canViewHiddenData,
} = props;

const {
allRemainingBookings,
Expand Down Expand Up @@ -381,7 +388,6 @@ export default function Success(props: PageProps) {
const isRescheduled = bookingInfo?.rescheduled;

const canCancelOrReschedule = !eventType?.disableCancelling || !eventType?.disableRescheduling;
const _canCancelAndReschedule = !eventType?.disableCancelling && !eventType?.disableRescheduling;

const canCancel = !eventType?.disableCancelling;
const canReschedule = !eventType?.disableRescheduling;
Expand Down Expand Up @@ -715,7 +721,7 @@ export default function Success(props: PageProps) {
</div>
</>
)}
{!!utmParams && isHost && (
{!!utmParams && canViewHiddenData && (
<>
<div className="mt-9 pr-2 font-medium sm:pr-0">{t("utm_params")}</div>
<div className="col-span-2 mb-2 ml-3 mt-9 sm:ml-0">
Expand All @@ -737,7 +743,7 @@ export default function Success(props: PageProps) {
{showUtmParams && (
<div className="col-span-2 mb-2 mt-2">
{Object.entries(utmParams).filter(([_, value]) => Boolean(value)).length >
0 ? (
0 ? (
<ul className="list-disc space-y-1 p-1 pl-5 sm:w-80">
{Object.entries(utmParams)
.filter(([_, value]) => Boolean(value))
Expand Down Expand Up @@ -845,11 +851,10 @@ export default function Success(props: PageProps) {
<span className="text-default inline">
<span className="underline" data-testid="reschedule-link">
<Link
href={`/reschedule/${seatReferenceUid || bookingInfo?.uid}${
currentUserEmail
? `?rescheduledBy=${encodeURIComponent(currentUserEmail)}`
: ""
}`}
href={`/reschedule/${seatReferenceUid || bookingInfo?.uid}${currentUserEmail
? `?rescheduledBy=${encodeURIComponent(currentUserEmail)}`
: ""
}`}
legacyBehavior>
{t("reschedule")}
</Link>
Expand Down
2 changes: 1 addition & 1 deletion packages/app-store/locations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export const privacyFilteredLocations = (locations: LocationObject[]): PrivacyFi
if (location.displayLocationPublicly || !eventLocationType) {
return location;
} else {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { address: _1, link: _2, hostPhoneNumber: _3, ...privacyFilteredLocation } = location;
logger.debug("Applied Privacy Filter", location, privacyFilteredLocation);
return privacyFilteredLocation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default class Office365CalendarService implements Calendar {
invalidateTokenObject: () => oAuthManagerHelper.invalidateCredential(credential.id),
expireAccessToken: () => oAuthManagerHelper.markTokenAsExpired(credential),
updateTokenObject: (tokenObject) => {
if (!Boolean(credential.delegatedTo)) {
if (!credential.delegatedTo) {
return oAuthManagerHelper.updateTokenObject({ tokenObject, credentialId: credential.id });
}
return Promise.resolve();
Expand Down
6 changes: 3 additions & 3 deletions packages/features/calAIPhone/zod-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ export const createPhoneCallSchema = requiredFields.merge(
.string()
.optional()
.transform((val) => {
return !!val ? val : undefined;
return val ? val : undefined;
}),
guestEmail: z
.string()
.optional()
.transform((val) => {
return !!val ? val : undefined;
return val ? val : undefined;
}),
guestCompany: z
.string()
.optional()
.transform((val) => {
return !!val ? val : undefined;
return val ? val : undefined;
}),
beginMessage: z.string().optional(),
generalPrompt: z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ export abstract class BaseOnboardingService implements IOrganizationOnboardingSe
logoUrl?: string | null;
bannerUrl?: string | null;
}> {
const uploadedLogoUrl = !!logoUrl ? await this.uploadImageAsset({ image: logoUrl, teamId: organizationId }) : logoUrl;
const uploadedLogoUrl = logoUrl ? await this.uploadImageAsset({ image: logoUrl, teamId: organizationId }) : logoUrl;

const uploadedBannerUrl = !!bannerUrl
const uploadedBannerUrl = bannerUrl
? await this.uploadImageAsset({ image: bannerUrl, teamId: organizationId, isBanner: true })
: bannerUrl;

Expand Down
Loading