Skip to content

Commit 10bf982

Browse files
Udit-takkarhbjORbjemrysal
authored
feat: add setting to automatic start recording (calcom#21853)
* feat: disable transcription setting in cal video * feat: add enable automatic recording feature * chore: only when organizer joins * chore: update name of variable * fix: improvements * chore: improvements * chore: add badge * refactor: cal video premium * tests: add tests for cal video * fix: use isOrganizer * Simplify type to remove 'as SessionUser' from new code --------- Co-authored-by: Benny Joo <sldisek783@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>
1 parent 8ee7b12 commit 10bf982

19 files changed

Lines changed: 817 additions & 157 deletions

File tree

apps/web/lib/video/[uid]/getServerSideProps.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type CalVideoSettings = {
2323
disableRecordingForGuests: boolean;
2424
disableRecordingForOrganizer: boolean;
2525
enableAutomaticTranscription: boolean;
26+
enableAutomaticRecordingForOrganizer: boolean;
2627
disableTranscriptionForGuests: boolean;
2728
disableTranscriptionForOrganizer: boolean;
2829
};
@@ -59,6 +60,21 @@ const shouldEnableAutomaticTranscription = ({
5960
return !!calVideoSettings.enableAutomaticTranscription;
6061
};
6162

63+
const shouldEnableAutomaticRecording = ({
64+
hasTeamPlan,
65+
calVideoSettings,
66+
isOrganizer,
67+
}: {
68+
hasTeamPlan: boolean;
69+
calVideoSettings?: CalVideoSettings | null;
70+
isOrganizer: boolean;
71+
}) => {
72+
if (!hasTeamPlan || !isOrganizer) return false;
73+
if (!calVideoSettings) return false;
74+
75+
return !!calVideoSettings.enableAutomaticRecordingForOrganizer;
76+
};
77+
6278
const shouldEnableTranscriptionButton = ({
6379
hasTeamPlan,
6480
calVideoSettings,
@@ -239,17 +255,24 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
239255
const showRecordingButton = shouldEnableRecordButton({
240256
hasTeamPlan: !!hasTeamPlan,
241257
calVideoSettings: bookingObj.eventType?.calVideoSettings,
242-
isOrganizer: sessionUserId === bookingObj.user?.id,
258+
isOrganizer,
243259
});
244260

245261
const enableAutomaticTranscription = shouldEnableAutomaticTranscription({
246262
hasTeamPlan: !!hasTeamPlan,
247263
calVideoSettings: bookingObj.eventType?.calVideoSettings,
248264
});
265+
266+
const enableAutomaticRecordingForOrganizer = shouldEnableAutomaticRecording({
267+
hasTeamPlan: !!hasTeamPlan,
268+
calVideoSettings: bookingObj.eventType?.calVideoSettings,
269+
isOrganizer,
270+
});
271+
249272
const showTranscriptionButton = shouldEnableTranscriptionButton({
250273
hasTeamPlan: !!hasTeamPlan,
251274
calVideoSettings: bookingObj.eventType?.calVideoSettings,
252-
isOrganizer: sessionUserId === bookingObj.user?.id,
275+
isOrganizer,
253276
});
254277

255278
return {
@@ -274,6 +297,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
274297
loggedInUserName: sessionUserId ? session?.user?.name : undefined,
275298
showRecordingButton,
276299
enableAutomaticTranscription,
300+
enableAutomaticRecordingForOrganizer,
277301
showTranscriptionButton,
278302
rediectAttendeeToOnExit: isOrganizer
279303
? undefined

0 commit comments

Comments
 (0)