diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx
index f600c6e697..32bb2ca515 100644
--- a/apps/web/components/booking/BookingListItem.tsx
+++ b/apps/web/components/booking/BookingListItem.tsx
@@ -141,17 +141,6 @@ function BookingListItem(booking: BookingItemProps) {
: []),
];
- const showRecordingActions: ActionType[] = [
- {
- id: "view_recordings",
- label: t("view_recordings"),
- onClick: () => {
- setViewRecordingsDialogIsOpen(true);
- },
- disabled: mutation.isLoading,
- },
- ];
-
let bookedActions: ActionType[] = [
{
id: "cancel",
@@ -270,11 +259,21 @@ function BookingListItem(booking: BookingItemProps) {
const bookingLink = buildBookingLink();
const title = booking.title;
- // To be used after we run query on legacy bookings
- // const showRecordingsButtons = booking.isRecorded && isPast && isConfirmed;
- const showRecordingsButtons =
- (booking.location === "integrations:daily" || booking?.location?.trim() === "") && isPast && isConfirmed;
+ const showRecordingsButtons = !!(booking.isRecorded && isPast && isConfirmed);
+ const checkForRecordingsButton =
+ !showRecordingsButtons && (booking.location === "integrations:daily" || booking?.location?.trim() === "");
+
+ const showRecordingActions: ActionType[] = [
+ {
+ id: checkForRecordingsButton ? "check_for_recordings" : "view_recordings",
+ label: checkForRecordingsButton ? t("check_for_recordings") : t("view_recordings"),
+ onClick: () => {
+ setViewRecordingsDialogIsOpen(true);
+ },
+ disabled: mutation.isLoading,
+ },
+ ];
return (
<>
@@ -299,7 +298,7 @@ function BookingListItem(booking: BookingItemProps) {
paymentCurrency={booking.payment[0].currency}
/>
)}
- {showRecordingsButtons && (
+ {(showRecordingsButtons || checkForRecordingsButton) && (
) : null}
{isPast && isPending && !isConfirmed ? : null}
- {showRecordingsButtons && }
+ {(showRecordingsButtons || checkForRecordingsButton) && (
+
+ )}
{isCancelled && booking.rescheduled && (
diff --git a/apps/web/pages/api/recorded-daily-video.ts b/apps/web/pages/api/recorded-daily-video.ts
index 0ce22581a8..c35a9d5c7f 100644
--- a/apps/web/pages/api/recorded-daily-video.ts
+++ b/apps/web/pages/api/recorded-daily-video.ts
@@ -62,6 +62,46 @@ const triggerWebhook = async ({
await Promise.all(promises);
};
+const checkIfUserIsPartOfTheSameTeam = async (
+ teamId: number | undefined | null,
+ userId: number,
+ userEmail: string | undefined | null
+) => {
+ if (!teamId) return false;
+
+ const getUserQuery = () => {
+ if (!!userEmail) {
+ return {
+ OR: [
+ {
+ id: userId,
+ },
+ {
+ email: userEmail,
+ },
+ ],
+ };
+ } else {
+ return {
+ id: userId,
+ };
+ }
+ };
+
+ const team = await prisma.team.findFirst({
+ where: {
+ id: teamId,
+ members: {
+ some: {
+ user: getUserQuery(),
+ },
+ },
+ },
+ });
+
+ return !!team;
+};
+
async function handler(req: NextApiRequest, res: NextApiResponse) {
if (!process.env.SENDGRID_API_KEY || !process.env.SENDGRID_EMAIL) {
return res.status(405).json({ message: "No SendGrid API key or email" });
@@ -137,12 +177,22 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
const isUserAttendeeOrOrganiser =
booking?.user?.id === session.user.id ||
- attendeesList.find((attendee) => attendee.id === session.user.id);
+ attendeesList.find(
+ (attendee) => attendee.id === session.user.id || attendee.email === session.user.email
+ );
if (!isUserAttendeeOrOrganiser) {
- return res.status(403).send({
- message: "Unauthorised",
- });
+ const isUserMemberOfTheTeam = checkIfUserIsPartOfTheSameTeam(
+ booking?.eventType?.teamId,
+ session.user.id,
+ session.user.email
+ );
+
+ if (!isUserMemberOfTheTeam) {
+ return res.status(403).send({
+ message: "Unauthorised",
+ });
+ }
}
await prisma.booking.update({
@@ -202,7 +252,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
return res.status(403).json({ message: "User does not have team plan to send out emails" });
} catch (err) {
- console.warn("something_went_wrong", err);
+ console.warn("Error in /recorded-daily-video", err);
return res.status(500).json({ message: "something went wrong" });
}
}
diff --git a/apps/web/pages/settings/security/password.tsx b/apps/web/pages/settings/security/password.tsx
index 71077c9447..e008234279 100644
--- a/apps/web/pages/settings/security/password.tsx
+++ b/apps/web/pages/settings/security/password.tsx
@@ -164,14 +164,13 @@ const PasswordView = ({ user }: PasswordViewProps) => {
<>
{user && user.identityProvider !== IdentityProvider.CAL ? (
-
-
-
- {t("account_managed_by_identity_provider", {
- provider: identityProviderNameMap[user.identityProvider],
- })}
-
-
+
+
+ {t("account_managed_by_identity_provider", {
+ provider: identityProviderNameMap[user.identityProvider],
+ })}
+
+
{t("account_managed_by_identity_provider_description", {
provider: identityProviderNameMap[user.identityProvider],
@@ -180,7 +179,7 @@ const PasswordView = ({ user }: PasswordViewProps) => {
) : (