mirror of
https://gitlab.com/comunic/comunicapiv2
synced 2025-06-20 08:35:17 +00:00
Remove conversation: Can delete conversation messages
This commit is contained in:
@ -306,6 +306,19 @@ export class ConversationsController {
|
||||
h.send(list.map(e => this.UnreadConversationToAPI(e)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Request a conversation
|
||||
*
|
||||
* @param h Request handler
|
||||
*/
|
||||
public static async DeleteConversation(h: RequestHandler) {
|
||||
const convID = await this.GetPostConversationId("conversationID", h);
|
||||
|
||||
await ConversationsHelper.RemoveUserFromConversation(h.getUserId(), convID);
|
||||
|
||||
h.success("The conversation has been deleted.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and return safely a conversation ID specified in a $_POST Request
|
||||
*
|
||||
|
@ -70,6 +70,8 @@ export const Routes : Route[] = [
|
||||
{path: "/conversations/get_number_unread", cb: (h) => ConversationsController.CountUnreadForUser(h)},
|
||||
|
||||
{path: "/conversations/get_list_unread", cb: (h) => ConversationsController.GetListUnread(h)},
|
||||
|
||||
{path: "/conversations/delete", cb: (h) => ConversationsController.DeleteConversation(h)},
|
||||
|
||||
|
||||
// Search controller
|
||||
|
Reference in New Issue
Block a user