Merge "Show placeholder widget when there are no notifications"

This commit is contained in:
jenkins-bot 2016-07-19 20:25:46 +00:00 committed by Gerrit Code Review
commit 47de8691eb

View file

@ -84,6 +84,7 @@
for ( i = 0; i < items.length; i++ ) {
if ( items[ i ] instanceof mw.echo.ui.CrossWikiNotificationItemWidget ) {
this.removeItems( [ items[ i ] ] );
this.checkForEmptyNotificationsList();
return;
}
}
@ -155,11 +156,7 @@
this.clearItems();
this.addItems( itemWidgets );
this.resetLoadingOption(
itemWidgets.length === 0 ?
mw.msg( 'echo-notification-placeholder' ) :
''
);
this.checkForEmptyNotificationsList();
};
/**
@ -196,6 +193,14 @@
}
};
/**
* Check if the list of notifications is empty and udpate the placeholder
* widget as needed.
*/
mw.echo.ui.NotificationsListWidget.prototype.checkForEmptyNotificationsList = function () {
this.resetLoadingOption( this.isEmpty() ? mw.msg( 'echo-notification-placeholder' ) : '' );
};
/**
* Reset the 'initiallyUnseen' state of all items
*/