mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
Notification count: don't assume 'all'
Bug: T139323 Change-Id: I44ebdc600015bdfadc07e313689b8fad1d1c60c0
This commit is contained in:
parent
4d5e4505df
commit
194b9c78a4
2
Echo.php
2
Echo.php
|
@ -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:
|
||||
|
|
|
@ -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 ) {
|
||||
foreach ( $sections as $section ) {
|
||||
$rawCount = $notifUser->getNotificationCount( /* $tryCache = */true, DB_SLAVE, $section, $global );
|
||||
$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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue