List is no longer an associative array

This would soon become problematic when output can come from
multiple sources, with potentially conflicting ids.
The ID is already included in the result anyway.

Change-Id: Id92150c71c68958819fe0ee329e70393052c34c9
This commit is contained in:
Matthias Mullie 2016-04-21 11:18:59 +02:00 committed by Roan Kattouw
parent e8d1f6a888
commit b10bd70033
2 changed files with 8 additions and 8 deletions

View file

@ -50,7 +50,7 @@ class ApiEchoNotifications extends ApiQueryBase {
if ( $foreignNotifications && $foreignNotifications->getCount( $section ) > 0 ) {
// insert fake notification for foreign notifications
$result[$section]['list'][-1] = $this->makeForeignNotification( $user, $params['format'], $foreignNotifications, $section );
array_unshift( $result[$section]['list'], $this->makeForeignNotification( $user, $params['format'], $foreignNotifications, $section ) );
}
$this->getResult()->setIndexedTagName( $result[$section]['list'], 'notification' );
@ -69,7 +69,7 @@ class ApiEchoNotifications extends ApiQueryBase {
$section = count( $params['sections'] ) === 1 ? reset( $params['sections'] ) : null;
if ( $foreignNotifications->getCount( $section ) > 0 ) {
$result['list'][-1] = $this->makeForeignNotification( $user, $params['format'], $foreignNotifications, $section );
array_unshift( $result['list'], $this->makeForeignNotification( $user, $params['format'], $foreignNotifications, $section ) );
}
}
@ -203,7 +203,7 @@ class ApiEchoNotifications extends ApiQueryBase {
foreach ( $notifs as $notif ) {
$output = EchoDataOutputFormatter::formatOutput( $notif, $format, $user, $this->getLanguage() );
if ( $output !== false ) {
$result['list'][$notif->getEvent()->getID()] = $output;
$result['list'][] = $output;
}
}

View file

@ -472,7 +472,7 @@
.then(
// Success
function ( data ) {
var notifData, id,
var i, notifData,
notificationModel, content,
newNotifData = {},
sources = {},
@ -481,8 +481,8 @@
data = data || {};
for ( id in data.list ) {
notifData = data.list[ id ];
for ( i = 0; i < data.list.length; i++ ) {
notifData = data.list[ i ];
content = notifData[ '*' ] || {};
// Collect common data
@ -514,7 +514,7 @@
model.api,
model.unreadCounter,
sources,
id,
notifData.id,
$.extend( true, {}, newNotifData, {
// This should probably be separated by bundled
// type. Some types don't have read messages, but
@ -531,7 +531,7 @@
);
} else {
notificationModel = new mw.echo.dm.NotificationItem(
id,
notifData.id,
newNotifData
);
}