mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 16:04:35 +00:00
Merge "mw.echo.overlay.updateCount() no longer exists"
This commit is contained in:
commit
f39ad2d842
|
@ -122,7 +122,8 @@
|
||||||
* Mark notifications as read.
|
* Mark notifications as read.
|
||||||
*/
|
*/
|
||||||
markAsRead: function ( unread ) {
|
markAsRead: function ( unread ) {
|
||||||
var api = new mw.Api(), that = this;
|
var newCount, rawCount, $badge,
|
||||||
|
api = new mw.Api(), that = this;
|
||||||
|
|
||||||
api.post( mw.echo.desktop.appendUseLang( {
|
api.post( mw.echo.desktop.appendUseLang( {
|
||||||
'action' : 'echomarkread',
|
'action' : 'echomarkread',
|
||||||
|
@ -131,9 +132,18 @@
|
||||||
} ) ).done( function ( result ) {
|
} ) ).done( function ( result ) {
|
||||||
// update the badge if the link is enabled
|
// update the badge if the link is enabled
|
||||||
if ( result.query.echomarkread.count !== undefined &&
|
if ( result.query.echomarkread.count !== undefined &&
|
||||||
$( '#pt-notifications').length && typeof mw.echo.overlay === 'object'
|
$( '#pt-notifications').length
|
||||||
) {
|
) {
|
||||||
mw.echo.overlay.updateCount( result.query.echomarkread.count, result.query.echomarkread.rawcount );
|
newCount = result.query.echomarkread.count;
|
||||||
|
rawCount = result.query.echomarkread.rawcount;
|
||||||
|
$badge = mw.echo.getBadge();
|
||||||
|
$badge.text( newCount );
|
||||||
|
|
||||||
|
if ( rawCount !== '0' && rawCount !== 0 ) {
|
||||||
|
$badge.addClass( 'mw-echo-unread-notifications' );
|
||||||
|
} else {
|
||||||
|
$badge.removeClass( 'mw-echo-unread-notifications' );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
that.onSuccess();
|
that.onSuccess();
|
||||||
} ).fail( function () {
|
} ).fail( function () {
|
||||||
|
|
Loading…
Reference in a new issue