Merge "Use the actual total notification count in the special page sidebar"

This commit is contained in:
jenkins-bot 2016-06-23 11:05:14 +00:00 committed by Gerrit Code Review
commit 190994bab2
2 changed files with 6 additions and 9 deletions

View file

@ -88,7 +88,10 @@ class ApiEchoUnreadNotificationPages extends ApiCrossWikiBase {
);
}
return array( 'pages' => $result );
return array(
'pages' => $result,
'totalCount' => MWEchoNotifUser::newFromUser( $this->getUser() )->getLocalNotificationCount(),
);
}
/**

View file

@ -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 );