Bsitu has uploaded a new change for review.
https://gerrit.wikimedia.org/r/158790
Change subject: mw.echo.overlay.updateCount() not longer exists
......................................................................
mw.echo.overlay.updateCount() not longer exists
If you have an unread notifications not in the initial
load of special page, clicking load more would throw
an error
Change-Id: I9af588780b2ab8481ba252ddc21bad0601de7a0b
---
M modules/special/ext.echo.special.js
1 file changed, 12 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/90/158790/1
diff --git a/modules/special/ext.echo.special.js
b/modules/special/ext.echo.special.js
index eb92347..c3a5457 100644
--- a/modules/special/ext.echo.special.js
+++ b/modules/special/ext.echo.special.js
@@ -122,7 +122,8 @@
* Mark notifications as read.
*/
markAsRead: function ( unread ) {
- var api = new mw.Api(), that = this;
+ var overlay, newCount, rawCount, $badge,
+ api = new mw.Api(), that = this;
api.post( mw.echo.desktop.appendUseLang( {
'action' : 'echomarkread',
@@ -133,7 +134,16 @@
if ( result.query.echomarkread.count !==
undefined &&
$( '#pt-notifications').length &&
typeof mw.echo.overlay === 'object'
) {
- 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();
} ).fail( function () {
--
To view, visit https://gerrit.wikimedia.org/r/158790
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9af588780b2ab8481ba252ddc21bad0601de7a0b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits