mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Delete notifications about post in different cases.
This commit is contained in:
parent
39458fd592
commit
abecb78111
@ -55,8 +55,8 @@ class commentsController {
|
|||||||
$notification->set_type(Notification::COMMENT_CREATED);
|
$notification->set_type(Notification::COMMENT_CREATED);
|
||||||
components()->notifications->push($notification);
|
components()->notifications->push($notification);
|
||||||
|
|
||||||
//Delete any other notification targeting this user about this post
|
//Delete any other notification targeting this user about the post
|
||||||
delete_user_notifications_other_post(userID, $postID);
|
delete_user_notifications_over_post(userID, $postID);
|
||||||
|
|
||||||
//Success
|
//Success
|
||||||
return array(
|
return array(
|
||||||
|
@ -51,6 +51,9 @@ class likesController {
|
|||||||
$id = getPostPostIDWithAccess("id");
|
$id = getPostPostIDWithAccess("id");
|
||||||
$componentType = Likes::LIKE_POST;
|
$componentType = Likes::LIKE_POST;
|
||||||
|
|
||||||
|
//Delete any notification targeting this user about the post
|
||||||
|
delete_user_notifications_over_post(userID, $id);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -404,6 +404,9 @@ class postsController {
|
|||||||
if(!components()->posts->update_content($postID, $new_content))
|
if(!components()->posts->update_content($postID, $new_content))
|
||||||
Rest_fatal_error(500, "An error occured while trying to update post content !");
|
Rest_fatal_error(500, "An error occured while trying to update post content !");
|
||||||
|
|
||||||
|
//Delete any notification targeting this user about the post
|
||||||
|
delete_user_notifications_over_post(userID, $postID);
|
||||||
|
|
||||||
//Success
|
//Success
|
||||||
return array("success" => "The post content has been updated !");
|
return array("success" => "The post content has been updated !");
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
* @param int $postID Target post
|
* @param int $postID Target post
|
||||||
* @return bool TRUE in case of success / FALSE else
|
* @return bool TRUE in case of success / FALSE else
|
||||||
*/
|
*/
|
||||||
function delete_user_notifications_other_post(int $userID, int $postID) : bool {
|
function delete_user_notifications_over_post(int $userID, int $postID) : bool {
|
||||||
|
|
||||||
|
user_login_required();
|
||||||
|
|
||||||
$notification = new Notification();
|
$notification = new Notification();
|
||||||
$notification->set_on_elem_type(Notification::POST);
|
$notification->set_on_elem_type(Notification::POST);
|
||||||
|
Loading…
Reference in New Issue
Block a user