1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-25 23:09:22 +00:00

Send a message through websocket for updated messages

This commit is contained in:
Pierre HUBERT 2020-04-02 18:43:06 +02:00
parent f8e8bc8322
commit a4dcf49d74
2 changed files with 13 additions and 2 deletions

View File

@ -143,7 +143,18 @@ export class UserWebSocketActions {
* @param msgID Message ID * @param msgID Message ID
*/ */
public static async UpdatedConversationMessage(msgID: number) { public static async UpdatedConversationMessage(msgID: number) {
console.info("Update conversation message " + msgID); const msg = await ConversationsHelper.GetSingleMessage(msgID);
for(const client of UserWebSocketController.active_clients.filter(
e => e.registeredConversations.has(msg.convID))) {
UserWebSocketController.SendToClient(client, new WsMessage({
id: "",
title: "updated_conv_message",
data: ConversationsController.ConversationMessageToAPI(msg)
}))
}
} }
/** /**

View File

@ -317,7 +317,7 @@ export class ConversationsHelper {
* @param messageID The ID of the message to get * @param messageID The ID of the message to get
* @throws If the message was not found * @throws If the message was not found
*/ */
private static async GetSingleMessage(messageID: number) : Promise<ConversationMessage> { public static async GetSingleMessage(messageID: number) : Promise<ConversationMessage> {
const row = await DatabaseHelper.QueryRow({ const row = await DatabaseHelper.QueryRow({
table: MESSAGES_TABLE, table: MESSAGES_TABLE,
where: { where: {