From 3d874b550bacc27ba6c8e369d71733c1d82d32b6 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 21 Feb 2018 16:18:32 +0100 Subject: [PATCH] Can get the number of unread notifications and conversations in a single API request --- RestControllers/notificationsController.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/RestControllers/notificationsController.php b/RestControllers/notificationsController.php index 204632e..423a203 100644 --- a/RestControllers/notificationsController.php +++ b/RestControllers/notificationsController.php @@ -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