Merge "Remove param index"

This commit is contained in:
jenkins-bot 2016-04-22 18:47:12 +00:00 committed by Gerrit Code Review
commit 748068b66c
6 changed files with 8 additions and 44 deletions

View file

@ -232,7 +232,6 @@
"apihelp-query+notifications-paramvalue-format-flyout": "<span class=\"apihelp-deprecated\">Deprecated</span>. Use <kbd>$1format=model</kbd> for raw data",
"apihelp-query+notifications-paramvalue-format-html": "<span class=\"apihelp-deprecated\">Deprecated</span>. Use <kbd>$1format=model</kbd> for raw data",
"apihelp-query+notifications-param-limit": "The maximum number of notifications to return.",
"apihelp-query+notifications-param-index": "If specified, a list of notification IDs, in order, will be returned.",
"apihelp-query+notifications-param-noforn": "True to opt out of data about notifications on foreign wikis.",
"apihelp-query+notifications-param-alertcontinue": "When more alert results are available, use this to continue.",
"apihelp-query+notifications-param-unreadfirst": "Whether to show unread notifications first (only used if groupbysection is not set).",

View file

@ -223,7 +223,6 @@
"apihelp-query+notifications-paramvalue-format-flyout": "<span class=\"apihelp-deprecated\">Deprecated</span>",
"apihelp-query+notifications-paramvalue-format-html": "<span class=\"apihelp-deprecated\">Deprecated</span>",
"apihelp-query+notifications-param-limit": "{{doc-apihelp-param|query+notifications|limit}}",
"apihelp-query+notifications-param-index": "{{doc-apihelp-param|query+notifications|index}}",
"apihelp-query+notifications-param-noforn": "{{doc-apihelp-param|query+notifications|noforn}}",
"apihelp-query+notifications-param-alertcontinue": "{{doc-apihelp-param|query+notifications|alertcontinue}}",
"apihelp-query+notifications-param-unreadfirst": "{{doc-apihelp-param|query+notifications|unreadfirst}}",

View file

@ -54,11 +54,6 @@ class ApiEchoNotifications extends ApiQueryBase {
}
$this->getResult()->setIndexedTagName( $result[$section]['list'], 'notification' );
// 'index' is built on top of 'list'
if ( in_array( 'index', $prop ) ) {
$result[$section]['index'] = $this->getPropIndex( $result[$section]['list'] );
$this->getResult()->setIndexedTagName( $result[$section]['index'], 'id' );
}
}
} else {
$attributeManager = EchoAttributeManager::newFromGlobalVars();
@ -79,11 +74,6 @@ class ApiEchoNotifications extends ApiQueryBase {
}
$this->getResult()->setIndexedTagName( $result['list'], 'notification' );
// 'index' is built on top of 'list'
if ( in_array( 'index', $prop ) ) {
$result['index'] = $this->getPropIndex( $result['list'] );
$this->getResult()->setIndexedTagName( $result['index'], 'id' );
}
}
}
@ -259,23 +249,6 @@ class ApiEchoNotifications extends ApiQueryBase {
return $result;
}
/**
* Internal helper method for getting property 'index' data
* @param array $list
* @return array
*/
protected function getPropIndex( $list ) {
$result = array();
foreach ( array_keys( $list ) as $key ) {
// Don't include the XML tag name ('_element' key)
if ( $key != '_element' ) {
$result[] = $key;
}
}
return $result;
}
protected function makeForeignNotification( User $user, $format, EchoForeignNotifications $foreignNotifications, $section = null ) {
$wikis = $foreignNotifications->getWikis( $section );
$count = $foreignNotifications->getCount( $section );
@ -340,7 +313,6 @@ class ApiEchoNotifications extends ApiQueryBase {
ApiBase::PARAM_TYPE => array(
'list',
'count',
'index',
),
ApiBase::PARAM_DFLT => 'list',
),
@ -371,7 +343,6 @@ class ApiEchoNotifications extends ApiQueryBase {
ApiBase::PARAM_MAX => ApiBase::LIMIT_SML1,
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_SML2,
),
'index' => false,
'continue' => array(
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
),

View file

@ -68,7 +68,7 @@
notformat: 'model',
notlimit: this.limit,
notunreadfirst: 1,
notprop: 'index|list|count',
notprop: 'list|count',
uselang: this.userLang
}, this.getTypeParams( type ) );

View file

@ -59,7 +59,7 @@
* Load more notification records.
*/
loadMore: function () {
var notifications, data, container, $li,
var notifications, container, $li,
api = new mw.Api( { ajax: { cache: false } } ),
seenTime = mw.config.get( 'wgEchoSeenTime' ),
that = this,
@ -68,7 +68,7 @@
action: 'query',
meta: 'notifications',
notformat: 'special',
notprop: 'index|list',
notprop: 'list',
notcontinue: this.notcontinue,
notlimit: mw.config.get( 'wgEchoDisplayNum' ),
uselang: useLang
@ -79,9 +79,7 @@
notifications = result.query.notifications;
unread = [];
$.each( notifications.index, function ( index, id ) {
data = notifications.list[ id ];
$.each( notifications.list, function ( index, data ) {
if ( that.header !== data.timestamp.date ) {
that.header = data.timestamp.date;
$( '<li></li>' ).addClass( 'mw-echo-date-section' ).append( that.header ).appendTo( container );
@ -89,7 +87,7 @@
$li = $( '<li></li>' )
.data( 'details', data )
.data( 'id', id )
.data( 'id', data.id )
.addClass( 'mw-echo-notification' )
.attr( {
'data-notification-category': data.category,
@ -101,7 +99,7 @@
if ( !data.read ) {
$li.addClass( 'mw-echo-unread' );
unread.push( id );
unread.push( data.id );
}
if ( seenTime !== null && data.timestamp.mw > seenTime ) {

View file

@ -15,7 +15,7 @@ class ApiEchoNotificationsTest extends ApiTestCase {
'notsections' => 'alert|message',
'notgroupbysection' => 1,
'notlimit' => 10,
'notprop' => 'index|list|count' ) );
'notprop' => 'list|count' ) );
$this->assertArrayHasKey( 'query', $data[0] );
$this->assertArrayHasKey( 'notifications', $data[0]['query'] );
@ -31,7 +31,6 @@ class ApiEchoNotificationsTest extends ApiTestCase {
$alert = $result['alert'];
$this->assertArrayHasKey( 'list', $alert );
$this->assertArrayHasKey( 'continue', $alert );
$this->assertArrayHasKey( 'index', $alert );
$this->assertArrayHasKey( 'rawcount', $alert );
$this->assertArrayHasKey( 'count', $alert );
@ -40,7 +39,6 @@ class ApiEchoNotificationsTest extends ApiTestCase {
$message = $result['message'];
$this->assertArrayHasKey( 'list', $message );
$this->assertArrayHasKey( 'continue', $message );
$this->assertArrayHasKey( 'index', $message );
$this->assertArrayHasKey( 'rawcount', $message );
$this->assertArrayHasKey( 'count', $message );
}
@ -51,7 +49,7 @@ class ApiEchoNotificationsTest extends ApiTestCase {
'meta' => 'notifications',
'notsections' => 'alert|message',
'notlimit' => 10,
'notprop' => 'index|list|count' ) );
'notprop' => 'list|count' ) );
$this->assertArrayHasKey( 'query', $data[0] );
$this->assertArrayHasKey( 'notifications', $data[0]['query'] );
@ -62,7 +60,6 @@ class ApiEchoNotificationsTest extends ApiTestCase {
$this->assertArrayHasKey( 'rawcount', $result );
$this->assertArrayHasKey( 'list', $result );
$this->assertArrayHasKey( 'continue', $result );
$this->assertArrayHasKey( 'index', $result );
$this->assertTrue( !isset( $result['alert'] ) );
$this->assertTrue( !isset( $result['message'] ) );