mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2024-11-22 13:29:22 +00:00
Propagate the deletion of a conversation message
This commit is contained in:
parent
5503d1af0b
commit
2465b0c1ac
@ -144,6 +144,19 @@ export class UserWebSocketActions {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Propagate the deletion of a conversation message
|
||||||
|
*
|
||||||
|
* @param msg Message ID
|
||||||
|
*/
|
||||||
|
public static async DeletedConversationMessage(msg: ConversationMessage) {
|
||||||
|
await UserWebSocketController.SendToSpecifcClients(
|
||||||
|
(e) => e.registeredConversations.has(msg.convID),
|
||||||
|
() => WsMessage.NoIDMessage("deleted_conv_message", ConversationsController.ConversationMessageToAPI(msg))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Propagate the creation of a new comment
|
* Propagate the creation of a new comment
|
||||||
*
|
*
|
||||||
@ -192,9 +205,10 @@ EventsHelper.Listen("updated_number_notifications", async (e) => await UserWebSo
|
|||||||
// When we get a new number of unread conversations
|
// When we get a new number of unread conversations
|
||||||
EventsHelper.Listen("updated_number_unread_conversations", async (e) => await UserWebSocketActions.SendNewUnreadConversationsCount(e.usersID));
|
EventsHelper.Listen("updated_number_unread_conversations", async (e) => await UserWebSocketActions.SendNewUnreadConversationsCount(e.usersID));
|
||||||
|
|
||||||
// When a new message is sent / updated
|
// When a new message is sent / updated / deleted
|
||||||
EventsHelper.Listen("sent_conversation_message", async (e) => await UserWebSocketActions.SentNewConversationMessage(e.msg));
|
EventsHelper.Listen("sent_conversation_message", async (e) => await UserWebSocketActions.SentNewConversationMessage(e.msg));
|
||||||
EventsHelper.Listen("conv_message_updated", async (e) => await UserWebSocketActions.UpdatedConversationMessage(e.msgId));
|
EventsHelper.Listen("conv_message_updated", async (e) => await UserWebSocketActions.UpdatedConversationMessage(e.msgId));
|
||||||
|
EventsHelper.Listen("conv_message_deleted", async (e) => await UserWebSocketActions.DeletedConversationMessage(e.message));
|
||||||
|
|
||||||
// When a comment is created / updated / deleted
|
// When a comment is created / updated / deleted
|
||||||
EventsHelper.Listen("comment_created", async (e) => await UserWebSocketActions.CreatedNewComment(e.comment))
|
EventsHelper.Listen("comment_created", async (e) => await UserWebSocketActions.CreatedNewComment(e.comment))
|
||||||
|
@ -709,6 +709,11 @@ export class ConversationsHelper {
|
|||||||
ID: m.id
|
ID: m.id
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Notify system
|
||||||
|
await EventsHelper.Emit("conv_message_deleted", {
|
||||||
|
message: m
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,6 +34,11 @@ export interface UpdatedConversationMessageEvent {
|
|||||||
msgId: number
|
msgId: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When a conversation message was deleted
|
||||||
|
export interface DeletedConversationMessageEvent {
|
||||||
|
message: ConversationMessage
|
||||||
|
}
|
||||||
|
|
||||||
// When a comment is created
|
// When a comment is created
|
||||||
export interface CommentCreatedEvent {
|
export interface CommentCreatedEvent {
|
||||||
comment: Comment
|
comment: Comment
|
||||||
@ -58,6 +63,7 @@ export interface EventsMap {
|
|||||||
"updated_number_unread_conversations": UpdateNumberUnreadConversationsEvent,
|
"updated_number_unread_conversations": UpdateNumberUnreadConversationsEvent,
|
||||||
"sent_conversation_message": SentNewConversationMessageEvent,
|
"sent_conversation_message": SentNewConversationMessageEvent,
|
||||||
"conv_message_updated": UpdatedConversationMessageEvent,
|
"conv_message_updated": UpdatedConversationMessageEvent,
|
||||||
|
"conv_message_deleted": DeletedConversationMessageEvent,
|
||||||
"comment_created": CommentCreatedEvent,
|
"comment_created": CommentCreatedEvent,
|
||||||
"comment_updated": CommentUpdatedEvent,
|
"comment_updated": CommentUpdatedEvent,
|
||||||
"comment_deleted": CommentDeletedEvent,
|
"comment_deleted": CommentDeletedEvent,
|
||||||
|
Loading…
Reference in New Issue
Block a user