mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge pull request #3819 from Nicofuma/ticket/14079
[ticket/14079] Correctly mark notifications as read
This commit is contained in:
commit
962fb6b19b
3 changed files with 17 additions and 10 deletions
|
@ -166,6 +166,7 @@ class manager
|
||||||
$notification_type_id = false;
|
$notification_type_id = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var method_interface $method */
|
||||||
foreach ($this->get_available_subscription_methods() as $method)
|
foreach ($this->get_available_subscription_methods() as $method)
|
||||||
{
|
{
|
||||||
$method->mark_notifications($notification_type_id, $item_id, $user_id, $time, $mark_read);
|
$method->mark_notifications($notification_type_id, $item_id, $user_id, $time, $mark_read);
|
||||||
|
@ -597,26 +598,32 @@ class manager
|
||||||
{
|
{
|
||||||
foreach ($types as $id => $type)
|
foreach ($types as $id => $type)
|
||||||
{
|
{
|
||||||
$subscriptions[$id] = array();
|
$type_subscriptions = $default_methods;
|
||||||
if (!empty($user_notifications[$id]))
|
if (!empty($user_notifications[$id]))
|
||||||
{
|
{
|
||||||
foreach ($user_notifications[$id] as $user_notification)
|
foreach ($user_notifications[$id] as $user_notification)
|
||||||
{
|
{
|
||||||
|
$key = array_search($user_notification['method'], $type_subscriptions, true);
|
||||||
if (!$user_notification['notify'])
|
if (!$user_notification['notify'])
|
||||||
{
|
{
|
||||||
|
if ($key !== false)
|
||||||
|
{
|
||||||
|
unset($type_subscriptions[$key]);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if ($key === false)
|
||||||
if (!isset($subscriptions[$id]))
|
|
||||||
{
|
{
|
||||||
$subscriptions[$id] = array();
|
$type_subscriptions[] = $user_notification['method'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$subscriptions[$id][] = $user_notification['method'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$subscriptions[$id] = array_merge($subscriptions[$id], $default_methods);
|
if (!empty($type_subscriptions))
|
||||||
|
{
|
||||||
|
$subscriptions[$id] = $type_subscriptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -503,7 +503,7 @@ abstract class base implements \phpbb\notification\type\type_interface
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->notification_manager->mark_notifications($this->get_type(), (int) $this->item_id, (int) $this->user_id, $this->notification_read);
|
$this->notification_manager->mark_notifications($this->get_type(), (int) $this->item_id, (int) $this->user_id, false, $this->notification_read);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ interface type_interface
|
||||||
* @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False)
|
* @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False)
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function mark_read($return);
|
public function mark_read($return = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark this item unread
|
* Mark this item unread
|
||||||
|
@ -214,5 +214,5 @@ interface type_interface
|
||||||
* @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False)
|
* @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False)
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function mark_unread($return);
|
public function mark_unread($return = false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue