Catrope has uploaded a new change for review. https://gerrit.wikimedia.org/r/295561
Change subject: Use the actual total notification count in the special page sidebar ...................................................................... Use the actual total notification count in the special page sidebar Adding up numbers in the front-end is not enough, because it could be that not all pages are listed (it's a top 10). So get the total count from the backend. Change-Id: Ibbc76691ef88333b92132a514fdba3cde3797e10 --- M includes/api/ApiEchoUnreadNotificationPages.php M modules/model/mw.echo.dm.SourcePagesModel.js 2 files changed, 6 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo refs/changes/61/295561/1 diff --git a/includes/api/ApiEchoUnreadNotificationPages.php b/includes/api/ApiEchoUnreadNotificationPages.php index 35136c0..a0fa918 100644 --- a/includes/api/ApiEchoUnreadNotificationPages.php +++ b/includes/api/ApiEchoUnreadNotificationPages.php @@ -88,7 +88,10 @@ ); } - return array( 'pages' => $result ); + return array( + 'pages' => $result, + 'totalCount' => MWEchoNotifUser::newFromUser( $this->getUser() )->getLocalNotificationCount(), + ); } /** diff --git a/modules/model/mw.echo.dm.SourcePagesModel.js b/modules/model/mw.echo.dm.SourcePagesModel.js index c5f679f..d71927e 100644 --- a/modules/model/mw.echo.dm.SourcePagesModel.js +++ b/modules/model/mw.echo.dm.SourcePagesModel.js @@ -189,18 +189,17 @@ * @param {Object} details Details object */ mw.echo.dm.SourcePagesModel.prototype.setSourcePagesDetails = function ( source, details ) { - var id, pageDetails, count; + var id, pageDetails; // Source information this.sources[ source ] = { title: details.source.title, base: details.source.base, - totalCount: 0, + totalCount: details.totalCount, pages: {} }; // Fill in pages - count = 0; for ( id in details.pages ) { pageDetails = details.pages[ id ]; this.sources[ source ].pages[ id ] = { @@ -208,11 +207,6 @@ count: pageDetails.count, id: id }; - - count += parseInt( pageDetails.count ); } - - // Update total count - this.sources[ source ].totalCount = count; }; } )( mediaWiki ); -- To view, visit https://gerrit.wikimedia.org/r/295561 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibbc76691ef88333b92132a514fdba3cde3797e10 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: Catrope <roan.katt...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits