1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/11449] Add separate method for deleting notifications by multiple types

PHPBB3-11449
This commit is contained in:
Marc Alexander
2023-07-02 09:56:10 +02:00
parent ce0f7cb1fe
commit d05ce65a98
3 changed files with 34 additions and 20 deletions

View File

@@ -474,25 +474,17 @@ class manager
}
/**
* Delete a notification
*
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $item_id is identical for the specified types)
* @param int|array $item_id Identifier within the type (or array of ids)
* @param mixed $parent_id Parent identifier within the type (or array of ids), used in combination with item_id if specified (Default: false; not checked)
* @param mixed $user_id User id (Default: false; not checked)
* Delete notifications of specified type
*
* @param string $notification_type_name Type identifier
* @param int|array $item_id Identifier within the type (or array of ids)
* @param mixed $parent_id Parent identifier within the type (or array of ids), used in combination with item_id if specified (Default: false; not checked)
* @param mixed $user_id User id (Default: false; not checked)
*
* @return void
*/
public function delete_notifications($notification_type_name, $item_id, $parent_id = false, $user_id = false)
public function delete_notifications(string $notification_type_name, $item_id, $parent_id = false, $user_id = false): void
{
if (is_array($notification_type_name))
{
foreach ($notification_type_name as $type)
{
$this->delete_notifications($type, $item_id, $parent_id, $user_id);
}
return;
}
$notification_type_id = $this->get_notification_type_id($notification_type_name);
/** @var method\method_interface $method */
@@ -502,6 +494,24 @@ class manager
}
}
/**
* Delete notifications specified by multiple types
*
* @param array $notification_type_names Array of item types (only acceptable if the $item_id is identical for the specified types)
* @param int|array $item_id Identifier within the type (or array of ids)
* @param mixed $parent_id Parent identifier within the type (or array of ids), used in combination with item_id if specified (Default: false; not checked)
* @param mixed $user_id User id (Default: false; not checked)
*
* @return void
*/
public function delete_notifications_by_types(array $notification_type_names, $item_id, $parent_id = false, $user_id = false): void
{
foreach ($notification_type_names as $type)
{
$this->delete_notifications($type, $item_id, $parent_id, $user_id);
}
}
/**
* Get all of the subscription types
*