mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 21:39:21 +00:00
Delete notifications on like updates
This commit is contained in:
parent
334496a63c
commit
3afc30fb89
@ -7,7 +7,7 @@ use crate::data::error::ExecError;
|
|||||||
use crate::data::group::GroupAccessLevel;
|
use crate::data::group::GroupAccessLevel;
|
||||||
use crate::data::http_request_handler::HttpRequestHandler;
|
use crate::data::http_request_handler::HttpRequestHandler;
|
||||||
use crate::data::post::PostAccessLevel;
|
use crate::data::post::PostAccessLevel;
|
||||||
use crate::helpers::{likes_helper, user_helper};
|
use crate::helpers::{likes_helper, notifications_helper, user_helper};
|
||||||
use crate::helpers::likes_helper::LikeType;
|
use crate::helpers::likes_helper::LikeType;
|
||||||
|
|
||||||
struct LikeTarget(u64, LikeType);
|
struct LikeTarget(u64, LikeType);
|
||||||
@ -35,7 +35,8 @@ pub fn update(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
"post" => {
|
"post" => {
|
||||||
let post = r.post_post_with_access("id", PostAccessLevel::BASIC_ACCESS)?;
|
let post = r.post_post_with_access("id", PostAccessLevel::BASIC_ACCESS)?;
|
||||||
|
|
||||||
// TODO : delete any notification targeting this user about the post
|
// Delete any notification targeting this user about the post
|
||||||
|
notifications_helper::delete_all_post_notifications_targeting_user(r.user_id_ref()?, post.id)?;
|
||||||
|
|
||||||
LikeTarget(post.id, LikeType::POST)
|
LikeTarget(post.id, LikeType::POST)
|
||||||
}
|
}
|
||||||
@ -43,6 +44,10 @@ pub fn update(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
// In case of comment
|
// In case of comment
|
||||||
"comment" => {
|
"comment" => {
|
||||||
let comment = r.post_comment_with_access("id")?;
|
let comment = r.post_comment_with_access("id")?;
|
||||||
|
|
||||||
|
// Delete any notification targeting this user about the post
|
||||||
|
notifications_helper::delete_all_post_notifications_targeting_user(r.user_id_ref()?, comment.post_id)?;
|
||||||
|
|
||||||
LikeTarget(comment.id, LikeType::COMMENT)
|
LikeTarget(comment.id, LikeType::COMMENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user