mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Merge "Use the actual total notification count in the special page sidebar"
This commit is contained in:
commit
190994bab2
|
@ -88,7 +88,10 @@ class ApiEchoUnreadNotificationPages extends ApiCrossWikiBase {
|
|||
);
|
||||
}
|
||||
|
||||
return array( 'pages' => $result );
|
||||
return array(
|
||||
'pages' => $result,
|
||||
'totalCount' => MWEchoNotifUser::newFromUser( $this->getUser() )->getLocalNotificationCount(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue