Drop unused zero class

Not used anywhere.

Change-Id: I848650e4e3497664d712537437d8a10b22d6afb1
This commit is contained in:
Jon Robson 2022-04-04 09:54:13 -07:00 committed by Jdlrobson
parent 70e0d4a281
commit 5350bba546
4 changed files with 4 additions and 11 deletions

View file

@ -926,7 +926,6 @@ class EchoHooks implements RecentChange_saveHook {
$notificationsTitle = SpecialPage::getTitleFor( 'Notifications' );
$count = 0;
$countLabel = '';
$isZero = true;
$hasUnseen = false;
if ( $title->equals( $notificationsTitle ) ) {
@ -952,7 +951,6 @@ class EchoHooks implements RecentChange_saveHook {
$alertNotificationTimestamp = $notifUser->getLastUnreadAlertTime();
$msgNotificationTimestamp = $notifUser->getLastUnreadMessageTime();
$isZero = $count === 0;
$hasUnseen = $count > 0 &&
(
$seenMsgTime !== false && $msgNotificationTimestamp !== false &&
@ -972,7 +970,6 @@ class EchoHooks implements RecentChange_saveHook {
'url' => $url,
'notificationCountRaw' => $count,
'notificationCountString' => $countLabel,
'isNotificationCountZero' => $isZero,
'hasNotifications' => $hasUnseen,
// this variable is used inside the client side which has different handling
// for when notifications have been dismissed. Instead of a bell it shows `(0)`.

View file

@ -74,7 +74,6 @@ NotificationBadge.prototype.setCount = function ( count ) {
this.options.notificationCountString = mw.message( 'echo-badge-count',
mw.language.convertNumber( count )
).text();
this.options.isNotificationCountZero = count === 0;
this.render();
};

View file

@ -8,8 +8,7 @@
<a href="{{url}}" title="{{title}}"
id="user-notifications"
data-event-name="ui.notifications"
class="mw-echo-notification-badge-nojs mw-echo-unseen-notifications notification-count user-button {{#hasUnseenNotifications}}notification-unseen{{/hasUnseenNotifications}}
{{#isNotificationCountZero}}zero{{/isNotificationCountZero}}">
class="mw-echo-notification-badge-nojs mw-echo-unseen-notifications notification-count user-button {{#hasUnseenNotifications}}notification-unseen{{/hasUnseenNotifications}}">
<div class="circle">
<span data-notification-count="{{notificationCountRaw}}">
{{notificationCountString}}

View file

@ -4,18 +4,16 @@
QUnit.module( 'ext.echo.mobile - NotificationBadge', {} );
QUnit.test( '#setCount', function ( assert ) {
var initialClassExpectationsMet,
var initialExpectationsMet,
badge = new NotificationBadge( {
hasNotifications: true,
hasUnseenNotifications: true,
notificationCountRaw: 5
} );
initialClassExpectationsMet = badge.$el.find( '.mw-ui-icon' ).length === 0 &&
badge.$el.find( '.zero' ).length === 0;
initialExpectationsMet = badge.$el.find( '.mw-ui-icon' ).length === 0;
badge.setCount( 0 );
assert.true( initialClassExpectationsMet, 'No icon and no zero class' );
assert.strictEqual( badge.$el.find( '.zero' ).length, 1, 'A zero class is present on the badge' );
assert.true( initialExpectationsMet, 'No icon.' );
badge.setCount( 105 );
assert.strictEqual( badge.options.notificationCountRaw, 100, 'Number is capped to 100.' );
} );