1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Create an event for updated conversation messages

This commit is contained in:
Pierre HUBERT 2020-04-02 18:38:29 +02:00
parent a083de5947
commit f8e8bc8322
3 changed files with 21 additions and 1 deletions

View File

@ -137,6 +137,15 @@ export class UserWebSocketActions {
}
/**
* Propagate the update of a conversation message
*
* @param msgID Message ID
*/
public static async UpdatedConversationMessage(msgID: number) {
console.info("Update conversation message " + msgID);
}
/**
* Propagate the creation of a new comment
*
@ -195,8 +204,9 @@ EventsHelper.Listen("updated_number_notifications", async (e) => await UserWebSo
// When we get a new number of unread conversations
EventsHelper.Listen("updated_number_unread_conversations", async (e) => await UserWebSocketActions.SendNewUnreadConversationsCount(e.usersID));
// When a new message is sent
// When a new message is sent / updated
EventsHelper.Listen("sent_conversation_message", async (e) => await UserWebSocketActions.SentNewConversationMessage(e.msg));
EventsHelper.Listen("conv_message_updated", async (e) => await UserWebSocketActions.UpdatedConversationMessage(e.msgId));
// When a comment is created / updated / deleted
EventsHelper.Listen("comment_created", async (e) => await UserWebSocketActions.CreatedNewComment(e.comment))

View File

@ -522,6 +522,10 @@ export class ConversationsHelper {
message: newContent
}
});
await EventsHelper.Emit("conv_message_updated", {
msgId: messageID
});
}
/**

View File

@ -29,6 +29,11 @@ export interface SentNewConversationMessageEvent {
msg: ConversationMessage
}
// When a conversation message is updated
export interface UpdatedConversationMessageEvent {
msgId: number
}
// When a comment is created
export interface CommentCreatedEvent {
comment: Comment
@ -52,6 +57,7 @@ export interface EventsMap {
"updated_number_notifications": UpdatedNotificationsNumberEvent,
"updated_number_unread_conversations": UpdateNumberUnreadConversationsEvent,
"sent_conversation_message": SentNewConversationMessageEvent,
"conv_message_updated": UpdatedConversationMessageEvent,
"comment_created": CommentCreatedEvent,
"comment_updated": CommentUpdatedEvent,
"comment_deleted": CommentDeletedEvent,