mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Improved a few things.
This commit is contained in:
parent
04f815792c
commit
82c375103b
@ -21,6 +21,10 @@ class notificationComponent {
|
|||||||
*/
|
*/
|
||||||
public function push(Notification $notification) : bool {
|
public function push(Notification $notification) : bool {
|
||||||
|
|
||||||
|
//Check if the time of creation of the notification has to be set
|
||||||
|
if(!$notification->has_time_create())
|
||||||
|
$notification->set_time_create(time());
|
||||||
|
|
||||||
//Determine the visibility level of the notification
|
//Determine the visibility level of the notification
|
||||||
if($notification->get_on_elem_type() == Notification::POST){
|
if($notification->get_on_elem_type() == Notification::POST){
|
||||||
|
|
||||||
@ -94,7 +98,7 @@ class notificationComponent {
|
|||||||
//Mark the notification as public
|
//Mark the notification as public
|
||||||
$notification->set_event_visibility(Notification::EVENT_PUBLIC);
|
$notification->set_event_visibility(Notification::EVENT_PUBLIC);
|
||||||
|
|
||||||
//Process the list of users
|
//Process the list of userso
|
||||||
foreach($usersID as $current_user){
|
foreach($usersID as $current_user){
|
||||||
|
|
||||||
//Set the current user id for the notification
|
//Set the current user id for the notification
|
||||||
@ -217,10 +221,13 @@ class notificationComponent {
|
|||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
|
if($notification->has_seen_state())
|
||||||
$data['seen'] = $notification->is_seen() ? 1 : 0;
|
$data['seen'] = $notification->is_seen() ? 1 : 0;
|
||||||
|
if($notification->has_from_user_id())
|
||||||
$data['from_user_id'] = $notification->get_from_user_id();
|
$data['from_user_id'] = $notification->get_from_user_id();
|
||||||
if($notification->has_dest_user_id())
|
if($notification->has_dest_user_id())
|
||||||
$data['dest_user_id'] = $notification->get_dest_user_id();
|
$data['dest_user_id'] = $notification->get_dest_user_id();
|
||||||
|
if($notification->has_type())
|
||||||
$data['type'] = $notification->get_type();
|
$data['type'] = $notification->get_type();
|
||||||
$data['on_elem_id'] = $notification->get_on_elem_id();
|
$data['on_elem_id'] = $notification->get_on_elem_id();
|
||||||
$data['on_elem_type'] = $notification->get_on_elem_type();
|
$data['on_elem_type'] = $notification->get_on_elem_type();
|
||||||
|
Loading…
Reference in New Issue
Block a user