mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-20 09:05:18 +00:00
Can delete groups.
This commit is contained in:
@ -93,7 +93,7 @@ class notificationComponent {
|
||||
//Determine the visibility level of the notification
|
||||
if($notification->get_on_elem_type() == Notification::POST){
|
||||
|
||||
//Fetch post informations
|
||||
//Fetch post information
|
||||
$info_post = components()->posts->get_single($notification->get_on_elem_id());
|
||||
|
||||
//Check for error
|
||||
@ -402,6 +402,21 @@ class notificationComponent {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete all the notifications related with a post
|
||||
*
|
||||
* @param int $postID The ID of the target post
|
||||
* @return bool TRUE for a success / FALSE else
|
||||
*/
|
||||
public function deleteAllRelatedWithPost(int $postID) : bool {
|
||||
|
||||
$notification = new Notification();
|
||||
$notification->set_on_elem_type(Notification::POST);
|
||||
$notification->set_on_elem_id($postID);
|
||||
return $this->delete($notification);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all the notifications related with a user
|
||||
*
|
||||
@ -421,6 +436,26 @@ class notificationComponent {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all the notifications related with a group
|
||||
*
|
||||
* @param int $groupID The ID of the target group
|
||||
* @return bool TRUE for a success / FALSE else
|
||||
*/
|
||||
public function deleteAllRelatedWithGroup(int $groupID) : bool {
|
||||
|
||||
//Groups membership notifications
|
||||
$notification = new Notification();
|
||||
$notification->set_on_elem_type(Notification::GROUP_MEMBERSHIP);
|
||||
$notification->set_on_elem_id($groupID);
|
||||
if(!$this->delete($notification)) return FALSE;
|
||||
|
||||
$notification->set_on_elem_type(Notification::GROUP_PAGE);
|
||||
if(!$this->delete($notification)) return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a notification object into database array
|
||||
*
|
||||
|
Reference in New Issue
Block a user