mirror of
				https://github.com/pierre42100/ComunicAPI
				synced 2025-11-04 04:04:20 +00:00 
			
		
		
		
	Can get the number of unread notifications and conversations in a single API request
This commit is contained in:
		@@ -27,6 +27,26 @@ class notificationsController {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Count all the new kinds of data
 | 
			
		||||
	 * 
 | 
			
		||||
	 * - notifications
 | 
			
		||||
	 * - unread conversations
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @url POST notifications/count_all_news
 | 
			
		||||
	 */
 | 
			
		||||
	public function count_all_news(){
 | 
			
		||||
 | 
			
		||||
		user_login_required();
 | 
			
		||||
 | 
			
		||||
		//Get and return the data
 | 
			
		||||
		return array(
 | 
			
		||||
			"notifications" => components()->notifications->count_unread(userID),
 | 
			
		||||
			"conversations" => components()->conversations->number_user_unread(userID)
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Get the list of unread notifications of a user
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user