mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
New notifications interaction.
This commit is contained in:
parent
c31c9488db
commit
4fb024f68a
@ -46,17 +46,22 @@ class commentsController {
|
|||||||
Rest_fatal_error(500, "An error occured while trying to create comment !");
|
Rest_fatal_error(500, "An error occured while trying to create comment !");
|
||||||
|
|
||||||
|
|
||||||
//Create a notification
|
//Create a notification about the comments created
|
||||||
$notification = new Notification();
|
$notification = new Notification();
|
||||||
$notification->set_time_create(time());
|
$notification->set_time_create(time());
|
||||||
$notification->set_from_user_id(userID);
|
$notification->set_from_user_id(userID);
|
||||||
$notification->set_on_elem_id($postID);
|
$notification->set_on_elem_id($postID);
|
||||||
$notification->set_on_elem_type(Notification::POST);
|
$notification->set_on_elem_type(Notification::POST);
|
||||||
$notification->set_type(Notification::COMMENT_CREATED);
|
$notification->set_type(Notification::COMMENT_CREATED);
|
||||||
|
|
||||||
//Push notification
|
|
||||||
components()->notifications->push($notification);
|
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);
|
||||||
|
|
||||||
//Success
|
//Success
|
||||||
return array(
|
return array(
|
||||||
"success" => "The comment was created!",
|
"success" => "The comment was created!",
|
||||||
|
Loading…
Reference in New Issue
Block a user