mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 05:19:22 +00:00
Check if there is an ongoing call on a conversation or not
This commit is contained in:
parent
2bb7acc4d7
commit
c50e9d3d23
@ -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
|
* Join a call
|
||||||
*
|
*
|
||||||
|
@ -6,6 +6,7 @@ import { removeHTMLNodes } from "../utils/StringUtils";
|
|||||||
import { ConversationMessage } from "../entities/ConversationMessage";
|
import { ConversationMessage } from "../entities/ConversationMessage";
|
||||||
import { UnreadConversation } from "../entities/UnreadConversation";
|
import { UnreadConversation } from "../entities/UnreadConversation";
|
||||||
import { CallsHelper } from "../helpers/CallsHelper";
|
import { CallsHelper } from "../helpers/CallsHelper";
|
||||||
|
import { CallsController } from "./CallsController";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Conversations controller
|
* Conversations controller
|
||||||
@ -372,7 +373,8 @@ export class ConversationsController {
|
|||||||
saw_last_message: c.sawLastMessage ? 1 : 0,
|
saw_last_message: c.sawLastMessage ? 1 : 0,
|
||||||
members: [...c.members],
|
members: [...c.members],
|
||||||
can_have_call: CallsHelper.CanHaveCall(c),
|
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)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user