Merge "Allow to define exceptions for Special:UncategorizedCategories on-wiki"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 11 Jan 2017 18:06:05 +0000 (18:06 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 11 Jan 2017 18:06:05 +0000 (18:06 +0000)
includes/site/HashSiteStore.php
resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js
tests/phpunit/includes/site/CachingSiteStoreTest.php

index 198d331..2c7965c 100644 (file)
@@ -37,7 +37,7 @@ class HashSiteStore implements SiteStore {
        private $sites = [];
 
        /**
-        * @param array $sites
+        * @param Site[] $sites
         */
        public function __construct( $sites = [] ) {
                $this->saveSites( $sites );
index b069d4a..e20b422 100644 (file)
                        api = apiUrl ? new mw.ForeignApi( apiUrl ) : new mw.Api();
 
                return api.get( {
+                       formatversion: 2,
                        action: 'query',
                        prop: 'info',
-                       indexpageids: true,
                        titles: title.getPrefixedDb()
                } ).then( function ( data ) {
-                       var pageId, page, contentModel, moduleName;
-                       if ( !data.query.pageids[ 0 ] ) {
+                       var contentModel, moduleName, page = data.query.pages[ 0 ];
+                       if ( !page ) {
                                return $.Deferred().reject( 'unexpected-response', 'Unexpected API response' );
                        }
-                       pageId = data.query.pageids[ 0 ];
-                       page = data.query.pages[ pageId ];
-
                        contentModel = page.contentmodel;
                        moduleName = 'mediawiki.messagePoster.' + contentModel;
                        return mw.loader.using( moduleName ).then( function () {
index edb8f9f..7e37907 100644 (file)
@@ -148,6 +148,11 @@ class CachingSiteStoreTest extends MediaWikiTestCase {
                $this->assertEquals( 0, $sites->count() );
        }
 
+       /**
+        * @param Site[] $sites
+        *
+        * @return SiteStore
+        */
        private function getHashSiteStore( array $sites ) {
                $siteStore = new HashSiteStore();
                $siteStore->saveSites( $sites );