jenkins-bot has submitted this change and it was merged.

Change subject: Never show a negative number in the notifications badge
......................................................................


Never show a negative number in the notifications badge

If we calculate a negative number should be shown, just show 0 instead.

Bug: T130853
Change-Id: I6e061525d034276cbb9e307eff53b77ddb06ef9a
---
M Hooks.php
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Hooks.php b/Hooks.php
index da17390..c9a745c 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -787,6 +787,10 @@
                $msgCount = $notifUser->getMessageCount() - $subtractMessages;
                $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();
                $alertNotificationTimestamp = 
$notifUser->getLastUnreadAlertTime();
 

-- 
To view, visit https://gerrit.wikimedia.org/r/282656
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6e061525d034276cbb9e307eff53b77ddb06ef9a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to