1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-07-11 18:12:49 +00:00

Delete all notifications related with friendship requests

This commit is contained in:
2021-01-24 17:57:30 +01:00
parent f84f925abc
commit f1525c4cc4
2 changed files with 16 additions and 1 deletions

@ -294,6 +294,20 @@ pub fn delete_all_related_with_post(post_id: PostID) -> ResultBoxError {
delete(&n)
}
/// Delete all the notifications related with a friendship request
pub fn delete_all_related_with_friendship_request(user_one: &UserID, user_two: &UserID) -> ResultBoxError {
let mut n = PartialNotification::new()
.set_on_elem_type(NotifElemType::FRIENDSHIP_REQUEST);
n.from_user_id = Some(user_one.clone());
n.dest_user_id = Some(user_two.clone());
delete(&n)?;
n.from_user_id = Some(user_two.clone());
n.dest_user_id = Some(user_one.clone());
delete(&n)
}
/// Check out whether a similar notification exists for given specifications
pub fn similar_exists(n: &PartialNotification) -> ResultBoxError<bool> {
database::QueryInfo::new(NOTIFICATIONS_TABLE)