mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-28 01:30:15 +00:00
Remove orange bar when all talk notifications are read
Don't just remove it when all notifications are read, but when all specifically talk notifications are read even if there are other unread notifications in the popup. Change-Id: I5aa65a4060d64f374b47fe91d8e53c92ded5fab2
This commit is contained in:
parent
d27daff8cb
commit
55e9d8e819
|
@ -69,7 +69,7 @@
|
|||
// Replace the link button with the ooui button
|
||||
$existingMessageLink.parent().replaceWith( mw.echo.ui.messageWidget.$element );
|
||||
|
||||
mw.echo.ui.messageWidget.getModel().on( 'allRead', function () {
|
||||
mw.echo.ui.messageWidget.getModel().on( 'allTalkRead', function () {
|
||||
// If there was a talk page notification, get rid of it
|
||||
$( '#pt-mytalk a' )
|
||||
.removeClass( 'mw-echo-alert' )
|
||||
|
|
|
@ -127,6 +127,23 @@
|
|||
if ( this.unreadNotifications.isEmpty() ) {
|
||||
this.emit( 'allRead' );
|
||||
}
|
||||
|
||||
if ( !this.countUnreadTalkPageNotifications() ) {
|
||||
this.emit( 'allTalkRead' );
|
||||
}
|
||||
};
|
||||
|
||||
mw.echo.dm.NotificationsModel.prototype.countUnreadTalkPageNotifications = function () {
|
||||
var i, len,
|
||||
talk = 0,
|
||||
items = this.unreadNotifications.getItems();
|
||||
|
||||
for ( i = 0, len = items.length; i < len; i++ ) {
|
||||
if ( items[i].getCategory() === 'edit-user-talk' ) {
|
||||
talk++;
|
||||
}
|
||||
}
|
||||
return talk;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue