1
0
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:
2019-12-07 18:06:41 +01:00
parent c9ee727629
commit 5a253f114c
4 changed files with 78 additions and 0 deletions

View File

@ -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
*

View File

@ -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