1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 00:45:18 +00:00

/notifications/mark_seen is fully implemented

This commit is contained in:
2020-07-11 14:10:01 +02:00
parent b133827c61
commit 2fc6b83f77
2 changed files with 25 additions and 9 deletions

View File

@ -8,7 +8,7 @@ use crate::api_data::res_number_unread_notifications::ResNumberUnreadNotificatio
use crate::controllers::routes::RequestResult;
use crate::data::error::ResultBoxError;
use crate::data::http_request_handler::HttpRequestHandler;
use crate::data::notification::{Notification, PartialNotification};
use crate::data::notification::Notification;
use crate::helpers::{conversations_helper, friends_helper, notifications_helper};
impl HttpRequestHandler {
@ -59,17 +59,15 @@ pub fn mark_seen(r: &mut HttpRequestHandler) -> RequestResult {
let notif = r.post_notif_id("notifID")?;
let delete_similar = r.post_bool_opt("delete_similar", false);
let mut notif = notif.into_partial();
// Check if we are targeting a precise notification or an undetermined number of similar
// notifications
if !delete_similar {
notifications_helper::delete(
&PartialNotification::new()
.set_id(notif.id)
)?;
} else {
// TODO : implement me
unimplemented!();
if delete_similar {
notif.id = None;
}
notifications_helper::delete(&notif)?;
r.success("Notification deleted")
}