[ticket/16544] Correctly mark notification read

PHPBB3-16544
This commit is contained in:
rxu 2020-09-02 22:10:37 +07:00
parent 02f54ef219
commit 8e2dd65c6e
No known key found for this signature in database
GPG key ID: 955F0567380E586A
2 changed files with 42 additions and 38 deletions

View file

@ -580,6 +580,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
'notification.type.post', 'notification.type.post',
'notification.type.approve_topic', 'notification.type.approve_topic',
'notification.type.approve_post', 'notification.type.approve_post',
'notification.type.forum',
), false, $user->data['user_id'], $post_time); ), false, $user->data['user_id'], $post_time);
if ($config['load_db_lastread'] && $user->data['is_registered']) if ($config['load_db_lastread'] && $user->data['is_registered'])
@ -663,6 +664,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
'notification.type.bookmark', 'notification.type.bookmark',
'notification.type.post', 'notification.type.post',
'notification.type.approve_post', 'notification.type.approve_post',
'notification.type.forum',
), $topic_ids, $user->data['user_id'], $post_time); ), $topic_ids, $user->data['user_id'], $post_time);
// Add 0 to forums array to mark global announcements correctly // Add 0 to forums array to mark global announcements correctly
@ -773,6 +775,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
'notification.type.bookmark', 'notification.type.bookmark',
'notification.type.post', 'notification.type.post',
'notification.type.approve_post', 'notification.type.approve_post',
'notification.type.forum',
), $topic_id, $user->data['user_id'], $post_time); ), $topic_id, $user->data['user_id'], $post_time);
if ($config['load_db_lastread'] && $user->data['is_registered']) if ($config['load_db_lastread'] && $user->data['is_registered'])

View file

@ -33,7 +33,7 @@ class forum extends \phpbb\notification\type\post
/** /**
* Notification option data (for outputting to the user) * Notification option data (for outputting to the user)
* *
* @var bool|array False if the service should use it's default data * @var bool|array False if the service should use its default data
* Array of data (including keys 'id', 'lang', and 'group') * Array of data (including keys 'id', 'lang', and 'group')
*/ */
static public $notification_option = [ static public $notification_option = [
@ -76,7 +76,8 @@ class forum extends \phpbb\notification\type\post
return []; return [];
} }
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications // Try to find the users who already have been notified about replies and have not read them
// Just update their notifications
$notified_users = $this->notification_manager->get_notified_users($this->get_type(), [ $notified_users = $this->notification_manager->get_notified_users($this->get_type(), [
'item_parent_id' => static::get_item_parent_id($post), 'item_parent_id' => static::get_item_parent_id($post),
'read' => 0, 'read' => 0,