diff --git a/src/script/view_model/CallingViewModel.ts b/src/script/view_model/CallingViewModel.ts index 3fb22f05d0f..d6e2feba5ac 100644 --- a/src/script/view_model/CallingViewModel.ts +++ b/src/script/view_model/CallingViewModel.ts @@ -331,6 +331,30 @@ export class CallingViewModel { } }; + const handleCallAction = async (conversationEntity: Conversation, callType: CALL_TYPE): Promise => { + const memberCount = conversationEntity.participating_user_ets().length; + if (memberCount > maxGroupSize) { + PrimaryModal.show(PrimaryModal.type.WITHOUT_TITLE, { + preventClose: true, + primaryAction: { + action: async () => await startCall(conversationEntity, callType), + text: t('groupCallModalPrimaryBtnName'), + }, + secondaryAction: { + text: t('modalConfirmSecondary'), + }, + text: { + htmlMessage: ``, + closeBtnLabel: t('groupCallModalCloseBtnLabel'), + }, + }); + } else { + await startCall(conversationEntity, callType); + } + }; + //update epoch info when AVS requests new epoch this.callingRepository.onRequestNewEpochCallback(conversationId => updateEpochInfo(conversationId, true)); @@ -374,34 +398,14 @@ export class CallingViewModel { if (conversationEntity.isGroup() && !this.teamState.isConferenceCallingEnabled()) { this.showRestrictedConferenceCallingModal(); } else { - const memberCount = conversationEntity.participating_user_ets().length; - if (memberCount > maxGroupSize) { - PrimaryModal.show(PrimaryModal.type.WITHOUT_TITLE, { - preventClose: true, - primaryAction: { - action: async () => await startCall(conversationEntity, CALL_TYPE.NORMAL), - text: t('groupCallModalPrimaryBtnName'), - }, - secondaryAction: { - text: t('modalConfirmSecondary'), - }, - text: { - htmlMessage: ``, - closeBtnLabel: t('groupCallModalCloseBtnLabel'), - }, - }); - } else { - await startCall(conversationEntity, CALL_TYPE.NORMAL); - } + handleCallAction(conversationEntity, CALL_TYPE.NORMAL); } }, startVideo: async (conversationEntity: Conversation) => { if (conversationEntity.isGroup() && !this.teamState.isConferenceCallingEnabled()) { this.showRestrictedConferenceCallingModal(); } else { - await startCall(conversationEntity, CALL_TYPE.VIDEO); + handleCallAction(conversationEntity, CALL_TYPE.VIDEO); } }, switchCameraInput: (call: Call, deviceId: string) => {