Notification count: don't assume 'all'

Bug: T139323
Change-Id: I44ebdc600015bdfadc07e313689b8fad1d1c60c0
This commit is contained in:
Stephane Bisson 2016-07-05 16:36:36 -04:00 committed by Mattflaschen
parent 4d5e4505df
commit 194b9c78a4
2 changed files with 8 additions and 8 deletions

View file

@ -546,7 +546,7 @@ $wgDefaultUserOptions['echo-subscriptions-web-article-linked'] = false;
// Echo Configuration for EventLogging
$wgEchoConfig = array(
'version' => '1.10',
'version' => '1.11',
'eventlogging' => array(
/**
* Properties:

View file

@ -285,18 +285,18 @@ class ApiEchoNotifications extends ApiCrossWikiBase {
$result = array();
$notifUser = MWEchoNotifUser::newFromUser( $user );
$global = $this->crossWikiSummary ? 'preference' : false;
// Always get total count
$rawCount = $notifUser->getNotificationCount( true, DB_SLAVE, EchoAttributeManager::ALL, $global );
$result['rawcount'] = $rawCount;
$result['count'] = EchoNotificationController::formatNotificationCount( $rawCount );
if ( $groupBySection ) {
$totalRawCount = 0;
foreach ( $sections as $section ) {
$rawCount = $notifUser->getNotificationCount( /* $tryCache = */true, DB_SLAVE, $section, $global );
if ( $groupBySection ) {
$result[$section]['rawcount'] = $rawCount;
$result[$section]['count'] = EchoNotificationController::formatNotificationCount( $rawCount );
}
$totalRawCount += $rawCount;
}
$result['rawcount'] = $totalRawCount;
$result['count'] = EchoNotificationController::formatNotificationCount( $totalRawCount );
return $result;
}