diff --git a/RestControllers/commentsController.php b/RestControllers/commentsController.php index 0de98c8..bf19027 100644 --- a/RestControllers/commentsController.php +++ b/RestControllers/commentsController.php @@ -56,11 +56,7 @@ class commentsController { components()->notifications->push($notification); //Delete any other notification targeting this user about this post - $notification = new Notification(); - $notification->set_on_elem_type(Notification::POST); - $notification->set_on_elem_id($postID); - $notification->set_dest_user_id(userID); - components()->notifications->delete($notification); + delete_user_notifications_other_post(userID, $postID); //Success return array( diff --git a/helpers/notifications.php b/helpers/notifications.php new file mode 100644 index 0000000..4adacb8 --- /dev/null +++ b/helpers/notifications.php @@ -0,0 +1,23 @@ +set_on_elem_type(Notification::POST); + $notification->set_on_elem_id($postID); + $notification->set_dest_user_id($userID); + return components()->notifications->delete($notification); + +} \ No newline at end of file