1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-09-25 22:29:45 +00:00

Can get the list of unread notifications

This commit is contained in:
2020-07-11 08:14:30 +02:00
parent 1eac896291
commit 87718076e7
8 changed files with 264 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
//!
//! @author Pierre Hubert
use crate::api_data::notification_api::NotificationAPI;
use crate::api_data::res_count_all_unreads::ResCountAllUnread;
use crate::api_data::res_number_unread_notifications::ResNumberUnreadNotifications;
use crate::controllers::routes::RequestResult;
@@ -24,4 +25,11 @@ pub fn count_all_news(r: &mut HttpRequestHandler) -> RequestResult {
};
r.set_response(ResCountAllUnread::new(notifications, conversations as u64, friends_requests))
}
/// Get the list of unread notifications
pub fn get_list_unread(r: &mut HttpRequestHandler) -> RequestResult {
let list = notifications_helper::get_list_unread(r.user_id_ref()?)?;
r.set_response(NotificationAPI::for_list(&list))
}