Merge "Never show a negative number in the notifications badge"

This commit is contained in:
jenkins-bot 2016-04-11 08:47:33 +00:00 committed by Gerrit Code Review
commit ebe216e4c1

View file

@ -787,6 +787,10 @@ class EchoHooks {
$msgCount = $notifUser->getMessageCount() - $subtractMessages; $msgCount = $notifUser->getMessageCount() - $subtractMessages;
$alertCount = $notifUser->getAlertCount() - $subtractAlerts; $alertCount = $notifUser->getAlertCount() - $subtractAlerts;
// But make sure we never show a negative number (T130853)
$msgCount = max( 0, $msgCount );
$alertCount = max( 0, $alertCount );
$msgNotificationTimestamp = $notifUser->getLastUnreadMessageTime(); $msgNotificationTimestamp = $notifUser->getLastUnreadMessageTime();
$alertNotificationTimestamp = $notifUser->getLastUnreadAlertTime(); $alertNotificationTimestamp = $notifUser->getLastUnreadAlertTime();