mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-03 11:04:02 +00:00 
			
		
		
		
	Can delete a single conversation message
This commit is contained in:
		@@ -340,6 +340,22 @@ export class ConversationsController {
 | 
			
		||||
		h.success("Conversation message content successfully update");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Delete a conversation message
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param h Request handler
 | 
			
		||||
	 */
 | 
			
		||||
	public static async DeleteMessage(h: RequestHandler) {
 | 
			
		||||
		const messageID = h.postInt("messageID");
 | 
			
		||||
 | 
			
		||||
		if(!await ConversationsHelper.IsUserMessageOwner(h.getUserId(), messageID))
 | 
			
		||||
			h.error(401, "You do not own this conversation message!");
 | 
			
		||||
		
 | 
			
		||||
		await ConversationsHelper.DeleteMessageById(messageID);
 | 
			
		||||
 | 
			
		||||
		h.success("Conversation message has been successfully deleted!");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get and return safely a conversation ID specified in a $_POST Request
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
@@ -74,6 +74,8 @@ export const Routes : Route[] = [
 | 
			
		||||
	{path: "/conversations/delete", cb: (h) => ConversationsController.DeleteConversation(h)},
 | 
			
		||||
 | 
			
		||||
	{path: "/conversations/updateMessage", cb: (h) => ConversationsController.UpdateMessage(h)},
 | 
			
		||||
 | 
			
		||||
	{path: "/conversations/deleteMessage", cb: (h) => ConversationsController.DeleteMessage(h)},
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	// Search controller
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user