Remove talk page notification bar if all messages are read

Bug: T106033
Change-Id: I5133896c204be701e0fae582af91c906175f39d1
This commit is contained in:
Moriel Schottlender 2015-09-17 13:47:23 -07:00
parent 60f97aff09
commit 8bc0c98b6f
3 changed files with 22 additions and 0 deletions

View file

@ -57,6 +57,11 @@
mw.echo.ui.messageWidget.badgeButton.debouncedUpdateThemeClasses();
// Replace the link button with the ooui button
$existingMessageLink.parent().replaceWith( mw.echo.ui.messageWidget.$element );
mw.echo.ui.messageWidget.getModel().on( 'allRead', function () {
// If there was a talk page notification, get rid of it
$( '#pt-mytalk' ).detach();
} );
}
// Load alerts popup and button

View file

@ -162,6 +162,13 @@
mw.echo.ui.NotificationBadgeWidget.static.tagName = 'li';
/* Events */
/**
* @event allRead
* All notifications were marked as read
*/
/* Methods */
/**

View file

@ -74,6 +74,12 @@
* Items' read status has changed
*/
/**
* @event allRead
*
* All items are marked as read
*/
/* Methods */
/**
@ -117,6 +123,10 @@
}
this.emit( 'unreadChange', this.unreadNotifications.getItems() );
}
if ( this.unreadNotifications.isEmpty() ) {
this.emit( 'allRead' );
}
};
/**