Update mw.api.watch according to new Watch API
authoreranroz <eranroz89@gmail.com>
Fri, 28 Feb 2014 07:46:13 +0000 (09:46 +0200)
committereranroz <eranroz89@gmail.com>
Fri, 28 Feb 2014 19:51:24 +0000 (21:51 +0200)
* Using titles instead of title which is deprecated
* Allow operation on multiple pages
Follow up of I820dcb64d469616b10741df013911197cc5bde29

Change-Id: Ic77b546c256fa70f253c7508defe4c0002258b2a

resources/mediawiki.api/mediawiki.api.watch.js

index 49a4c62..ab8a512 100644 (file)
@@ -8,7 +8,7 @@
         * @private
         * @context mw.Api
         *
-        * @param {String|mw.Title} page Full page name or instance of mw.Title
+        * @param {string|mw.Title|string[]|mw.Title[]} page Full page name or instance of mw.Title or array of pages
         * @param {Function} [ok] Success callback (deprecated)
         * @param {Function} [err] Error callback (deprecated)
         * @return {jQuery.Promise}
@@ -28,7 +28,7 @@
 
                params = {
                        action: 'watch',
-                       title: String( page ),
+                       titles: $.isArray( page ) ? page.join( '|' ) : String( page ),
                        token: mw.user.tokens.get( 'watchToken' ),
                        uselang: mw.config.get( 'wgUserLanguage' )
                };