1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-22 08:30:26 +01:00

Merge pull request #4548 from nicebb/ticket/13757

[ticket/13757] Prevents the count of unread PMs from being negative
This commit is contained in:
Marc Alexander 2016-12-01 11:41:17 +01:00
commit 365489a317
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -892,6 +892,12 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id)
AND folder_id = $folder_id";
$db->sql_query($sql);
// If the message is already marked as read, we just skip the rest to avoid negative PM count
if (!$db->sql_affectedrows())
{
return;
}
$sql = 'UPDATE ' . USERS_TABLE . "
SET user_unread_privmsg = user_unread_privmsg - 1
WHERE user_id = $user_id";