1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-26 13:38:52 +00:00

Check if there is an ongoing call on a conversation or not

This commit is contained in:
Pierre HUBERT 2020-04-13 14:35:36 +02:00
parent 2bb7acc4d7
commit c50e9d3d23
2 changed files with 15 additions and 1 deletions

View File

@ -40,6 +40,18 @@ export class CallsController {
})
}
/**
* Check out whether a call is currently happening for a given
* conversation
*
* @param convID The ID of the conversation to check
* @return {boolean} True if there is an ongoing call / false else
*/
public static IsHavingCall(convID: number) : boolean {
return UserWebSocketController.active_clients
.find((f) => f.activeCalls.has(convID)) !== undefined;
}
/**
* Join a call
*

View File

@ -6,6 +6,7 @@ import { removeHTMLNodes } from "../utils/StringUtils";
import { ConversationMessage } from "../entities/ConversationMessage";
import { UnreadConversation } from "../entities/UnreadConversation";
import { CallsHelper } from "../helpers/CallsHelper";
import { CallsController } from "./CallsController";
/**
* Conversations controller
@ -372,7 +373,8 @@ export class ConversationsController {
saw_last_message: c.sawLastMessage ? 1 : 0,
members: [...c.members],
can_have_call: CallsHelper.CanHaveCall(c),
can_have_video_call: CallsHelper.CanHaveVideoCAll(c)
can_have_video_call: CallsHelper.CanHaveVideoCAll(c),
has_call_now: CallsController.IsHavingCall(c.id)
};
}