From 39458fd5927eb4dd62457b35925c310e23010515 Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 18 Feb 2018 18:43:58 +0100 Subject: [PATCH] Created notification helper --- RestControllers/commentsController.php | 6 +----- helpers/notifications.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 helpers/notifications.php 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