From 76105957a0423cec6251bd28587890a8b1fd717f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 10 Apr 2020 11:08:18 +0200 Subject: [PATCH] Add check for video calls --- src/controllers/ConversationsController.ts | 3 ++- src/helpers/CallsHelper.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/controllers/ConversationsController.ts b/src/controllers/ConversationsController.ts index 7ba8e57..6bb73ee 100644 --- a/src/controllers/ConversationsController.ts +++ b/src/controllers/ConversationsController.ts @@ -371,7 +371,8 @@ export class ConversationsController { following: c.following ? 1 : 0, saw_last_message: c.sawLastMessage ? 1 : 0, members: [...c.members], - can_have_call: CallsHelper.CanHaveCall(c) + can_have_call: CallsHelper.CanHaveCall(c), + can_have_video_call: CallsHelper.CanHaveVideoCAll(c) }; } diff --git a/src/helpers/CallsHelper.ts b/src/helpers/CallsHelper.ts index 2af369b..98b7eb8 100644 --- a/src/helpers/CallsHelper.ts +++ b/src/helpers/CallsHelper.ts @@ -21,4 +21,14 @@ export class CallsHelper { && conf().rtc_relay.maxUsersPerCalls >= conv.members.size) === true } + /** + * Check out whether a given conversation is allowed to make video + * calls or not + * + * @param conv Target conversation + */ + public static CanHaveVideoCAll(conv: Conversation) : boolean { + return this.CanHaveCall(conv) && conf().rtc_relay.allowVideo; + } + } \ No newline at end of file