feat: automatic no show (#16727)
Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: zomars <[email protected]>
This commit is contained in:
43 files changed
+1103
-69
No files matched your search
@@ -0,0 +1,36 @@
|
||||
import { CronJob } from "cron";
|
||||
|
||||
async function fetchCron(endpoint: string) {
|
||||
const apiKey = process.env.CRON_API_KEY;
|
||||
|
||||
const res = await fetch(`http://localhost:3000/api${endpoint}?${apiKey}`, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
authorization: `Bearer ${process.env.CRON_SECRET}`,
|
||||
},
|
||||
});
|
||||
const json = await res.json();
|
||||
console.log(endpoint, json);
|
||||
}
|
||||
|
||||
try {
|
||||
console.log("⏳ Running cron endpoints");
|
||||
new CronJob(
|
||||
// Each 5 seconds
|
||||
"*/5 * * * * *",
|
||||
async function () {
|
||||
await Promise.allSettled([
|
||||
fetchCron("/tasks/cron"),
|
||||
// fetchCron("/cron/calVideoNoShowWebhookTriggers"),
|
||||
//
|
||||
// fetchCron("/tasks/cleanup"),
|
||||
]);
|
||||
},
|
||||
null,
|
||||
true,
|
||||
"America/Los_Angeles"
|
||||
);
|
||||
} catch (_err) {
|
||||
console.error("❌ ❌ ❌ Something went wrong ❌ ❌ ❌");
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import type { GetServerSidePropsContext } from "next";
|
||||
|
||||
import {
|
||||
generateGuestMeetingTokenFromOwnerMeetingToken,
|
||||
setEnableRecordingUIForOrganizer,
|
||||
setEnableRecordingUIAndUserIdForOrganizer,
|
||||
} from "@calcom/app-store/dailyvideo/lib/VideoApiAdapter";
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { getCalVideoReference } from "@calcom/features/get-cal-video-reference";
|
||||
@@ -81,18 +81,20 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
// set meetingPassword for guests
|
||||
if (session?.user.id !== bookingObj.user?.id) {
|
||||
const guestMeetingPassword = await generateGuestMeetingTokenFromOwnerMeetingToken(
|
||||
oldVideoReference.meetingPassword
|
||||
oldVideoReference.meetingPassword,
|
||||
session?.user.id
|
||||
);
|
||||
|
||||
bookingObj.references.forEach((bookRef) => {
|
||||
bookRef.meetingPassword = guestMeetingPassword;
|
||||
});
|
||||
}
|
||||
// Only for backward compatibility for organizer
|
||||
// Only for backward compatibility and setting user id in particpants for organizer
|
||||
else {
|
||||
const meetingPassword = await setEnableRecordingUIForOrganizer(
|
||||
const meetingPassword = await setEnableRecordingUIAndUserIdForOrganizer(
|
||||
oldVideoReference.id,
|
||||
oldVideoReference.meetingPassword
|
||||
oldVideoReference.meetingPassword,
|
||||
session?.user.id
|
||||
);
|
||||
if (!!meetingPassword) {
|
||||
bookingObj.references.forEach((bookRef) => {
|
||||
|
||||
+8
@@ -69,6 +69,14 @@ export default function EditOAuthClientWebhooks() {
|
||||
value: WebhookTriggerEvents.RECORDING_TRANSCRIPTION_GENERATED,
|
||||
label: "recording_transcription_generated",
|
||||
},
|
||||
{
|
||||
value: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,
|
||||
label: "after_hosts_cal_video_no_show",
|
||||
},
|
||||
{
|
||||
value: WebhookTriggerEvents.AFTER_GUESTS_CAL_VIDEO_NO_SHOW,
|
||||
label: "after_guests_cal_video_no_show",
|
||||
},
|
||||
]}
|
||||
onSubmit={async (data) => {
|
||||
try {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"analyze:browser": "BUNDLE_ANALYZE=browser next build",
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .next",
|
||||
"dev": "next dev",
|
||||
"dev:cron": "ts-node cron-tester.ts",
|
||||
"dev-https": "NODE_TLS_REJECT_UNAUTHORIZED=0 next dev --experimental-https",
|
||||
"dx": "yarn dev",
|
||||
"test-codegen": "yarn playwright codegen http://localhost:3000",
|
||||
@@ -173,6 +174,7 @@
|
||||
"@types/uuid": "8.3.1",
|
||||
"autoprefixer": "^10.4.12",
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"cron": "^3.1.7",
|
||||
"deasync": "^0.1.30",
|
||||
"detect-port": "^1.3.0",
|
||||
"env-cmd": "^10.1.0",
|
||||
|
||||
@@ -1227,6 +1227,8 @@
|
||||
"number_provided": "Phone number will be provided",
|
||||
"before_event_trigger": "before event starts",
|
||||
"event_cancelled_trigger": "when event is canceled",
|
||||
"after_hosts_cal_video_no_show": "After hosts don't join cal video",
|
||||
"after_guests_cal_video_no_show": "After guests don't join cal video",
|
||||
"new_event_trigger": "when new event is booked",
|
||||
"email_host_action": "send email to host",
|
||||
"email_attendee_action": "send email to attendees",
|
||||
@@ -1643,6 +1645,9 @@
|
||||
"email_address_action": "send email to a specific email address",
|
||||
"after_event_trigger": "after event ends",
|
||||
"how_long_after": "How long after event ends?",
|
||||
"how_long_after_hosts_no_show": "How long after hosts don't show up on cal video meeting?",
|
||||
"how_long_after_guests_no_show": "How long after guests don't show up on cal video meeting?",
|
||||
"how_long_after_user_no_show_minutes": "How long after the users don't show up on cal video meeting?",
|
||||
"no_available_slots": "No Available slots",
|
||||
"time_available": "Time available",
|
||||
"cant_find_the_right_conferencing_app_visit_our_app_store": "Can't find the right conferencing app? Visit our <1>App Store</1>.",
|
||||
|
||||
@@ -193,6 +193,7 @@ type WhiteListedBookingProps = {
|
||||
// TODO: Make sure that all references start providing credentialId and then remove this intersection of optional credentialId
|
||||
credentialId?: number | null;
|
||||
})[];
|
||||
user?: { id: number };
|
||||
bookingSeat?: Prisma.BookingSeatCreateInput[];
|
||||
createdAt?: string;
|
||||
};
|
||||
@@ -400,6 +401,7 @@ async function addBookingsToDb(
|
||||
bookings: (Prisma.BookingCreateInput & {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
references: any[];
|
||||
user?: { id: number };
|
||||
})[]
|
||||
) {
|
||||
log.silly("TestData: Creating Bookings", JSON.stringify(bookings));
|
||||
@@ -490,6 +492,16 @@ export async function addBookings(bookings: InputBooking[]) {
|
||||
};
|
||||
}
|
||||
|
||||
if (booking?.user?.id) {
|
||||
bookingCreate.user = {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
//@ts-ignore
|
||||
connect: {
|
||||
id: booking.user.id,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return bookingCreate;
|
||||
})
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user