Don't list foreign notifications for both sections when not using groupbysection

API requests with notgroupbysection disabled but notsection set
to 'alert' would return foreign notification bundles for both
alerts and messages, separately.

The frontend always pasess notgroupbysection=1 in practice because
notmessageunreadfirst=1 doesn't work without it; but regardless of
that, the API module shouldn't return a foreign notification bundle
for messages when only alerts are requested.

Change-Id: I9fa6d1411a8c121591ce6dd75ee8052bcdcb478b
This commit is contained in:
Roan Kattouw 2016-03-01 16:45:37 -08:00
parent 22fa76dabe
commit 20f091982c

View file

@ -70,7 +70,7 @@ class ApiEchoNotifications extends ApiQueryBase {
if ( $foreignNotifications ) {
// insert fake notifications for foreign notifications
foreach ( EchoAttributeManager::$sections as $i => $section ) {
foreach ( $params['sections'] as $i => $section ) {
if ( $foreignNotifications->getCount( $section ) > 0 ) {
$result['list'][-$i-1] = $this->makeForeignNotification( $user, $params['format'], $foreignNotifications, $section );
}