Skip to content

Commit 5108192

Browse files
author
neha
committed
fix: use existing isTeamAdmin function and remove unnecessary UI changes
1 parent 59e0a20 commit 5108192

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

apps/web/modules/bookings/views/bookings-single-view.getServerSideProps.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { shouldHideBrandingForEvent } from "@calcom/lib/hideBranding";
1111
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
1212
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
1313
import { maybeGetBookingUidFromSeat } from "@calcom/lib/server/maybeGetBookingUidFromSeat";
14+
import { isTeamAdmin } from "@calcom/lib/server/queries/teams";
1415
import { BookingRepository } from "@calcom/lib/server/repository/booking";
1516
import prisma from "@calcom/prisma";
1617
import { customInputSchema } from "@calcom/prisma/zod-utils";
@@ -178,22 +179,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
178179

179180
const isLoggedInUserTeamAdmin = !!(
180181
userId &&
181-
((eventType.team?.id &&
182-
(await prisma.membership.findUnique({
183-
where: {
184-
userId_teamId: { userId, teamId: eventType.team.id },
185-
accepted: true,
186-
OR: [{ role: "ADMIN" }, { role: "OWNER" }],
187-
},
188-
}))) ||
189-
(eventType.parent?.teamId &&
190-
(await prisma.membership.findUnique({
191-
where: {
192-
userId_teamId: { userId, teamId: eventType.parent.teamId },
193-
accepted: true,
194-
OR: [{ role: "ADMIN" }, { role: "OWNER" }],
195-
},
196-
}))))
182+
((eventType.team?.id && (await isTeamAdmin(userId, eventType.team.id))) ||
183+
(eventType.parent?.teamId && (await isTeamAdmin(userId, eventType.parent.teamId))))
197184
);
198185

199186
const canViewHiddenData = isLoggedInUserHost || isLoggedInUserTeamAdmin;

apps/web/modules/bookings/views/bookings-single-view.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export default function Success(props: PageProps) {
385385
const isRescheduled = bookingInfo?.rescheduled;
386386

387387
const canCancelOrReschedule = !eventType?.disableCancelling || !eventType?.disableRescheduling;
388-
const canCancelAndReschedule = !eventType?.disableCancelling && !eventType?.disableRescheduling;
388+
const _canCancelAndReschedule = !eventType?.disableCancelling && !eventType?.disableRescheduling;
389389

390390
const canCancel = !eventType?.disableCancelling;
391391
const canReschedule = !eventType?.disableRescheduling;
@@ -471,7 +471,7 @@ export default function Success(props: PageProps) {
471471
{!isFeedbackMode && (
472472
<>
473473
<div
474-
className={classNames(isRoundRobin && "relative mx-auto h-24 min-h-24 w-32 min-w-32")}>
474+
className={classNames(isRoundRobin && "min-w-22 w-22 relative mx-auto h-24 min-h-24")}>
475475
{isRoundRobin && bookingInfo.user && (
476476
<Avatar
477477
className="mx-auto flex items-center justify-center"
@@ -557,7 +557,7 @@ export default function Success(props: PageProps) {
557557
</h4>
558558
)}
559559

560-
<div className="border-subtle text-default mt-8 grid grid-cols-3 gap-x-4 border-t pt-8 text-left sm:gap-x-0 rtl:text-right">
560+
<div className="border-subtle text-default mt-2 grid grid-cols-2 gap-x-4 border-t pt-2 text-left rtl:text-right">
561561
{(isCancelled || reschedule) && cancellationReason && (
562562
<>
563563
<div className="font-medium">
@@ -1081,7 +1081,7 @@ export default function Success(props: PageProps) {
10811081
</div>
10821082
{isGmail && !isFeedbackMode && (
10831083
<Alert
1084-
className="main -mb-20 mt-4 inline-block sm:-mt-4 sm:mb-4 sm:w-full sm:max-w-xl sm:align-middle ltr:text-left rtl:text-right"
1084+
className="main -mb-20 mt-4 inline-block ltr:text-left rtl:text-right"
10851085
severity="warning"
10861086
message={
10871087
<div>

0 commit comments

Comments
 (0)