mirror of
				https://gitlab.com/comunic/comunicapiv2
				synced 2025-11-03 11:04:02 +00:00 
			
		
		
		
	Get the number of unread conversations of the user
This commit is contained in:
		@@ -283,6 +283,17 @@ export class ConversationsController {
 | 
			
		||||
		h.send(messages.map(e => this.ConversationMessageToAPI(e)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get the number of unread conversations for the user
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param h Request handler
 | 
			
		||||
	 */
 | 
			
		||||
	public static async CountUnreadForUser(h: RequestHandler) {
 | 
			
		||||
		h.send({
 | 
			
		||||
			nb_unread: await ConversationsHelper.CountUnreadForUser(h.getUserId())
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get and return safely a conversation ID specified in a $_POST Request
 | 
			
		||||
	 * 
 | 
			
		||||
 
 | 
			
		||||
@@ -66,6 +66,8 @@ export const Routes : Route[] = [
 | 
			
		||||
	{path: "/conversations/sendMessage", cb: (h) => ConversationsController.SendMessage(h)},
 | 
			
		||||
 | 
			
		||||
	{path: "/conversations/get_older_messages", cb: (h) => ConversationsController.GetOlderMessages(h)},
 | 
			
		||||
 | 
			
		||||
	{path: "/conversations/get_number_unread", cb: (h) => ConversationsController.CountUnreadForUser(h)}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	// Search controller
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user