Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/282656
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/56/282656/1
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: newchange
Gerrit-Change-Id: I6e061525d034276cbb9e307eff53b77ddb06ef9a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits