* @private
* @context mw.Api
*
- * @param {string|mw.Title|string[]|mw.Title[]} page Full page name or instance of mw.Title or array of pages
+ * @param {string|mw.Title|string[]|mw.Title[]} page Full page name or instance of mw.Title, or an
+ * array thereof. If an array is passed, the return value passed to the promise will also be an
+ * array of appropriate objects.
* @param {Function} [ok] Success callback (deprecated)
* @param {Function} [err] Error callback (deprecated)
* @return {jQuery.Promise}
* @return {Function} return.done
- * @return {Object} return.done.watch
+ * @return {Object|Object[]} return.done.watch
* @return {string} return.done.watch.title Full pagename
* @return {boolean} return.done.watch.watched
* @return {string} return.done.watch.message Parsed HTML of the confirmational interface message
params = {
action: 'watch',
- titles: $.isArray( page ) ? page.join( '|' ) : String( page ),
token: mw.user.tokens.get( 'watchToken' ),
uselang: mw.config.get( 'wgUserLanguage' )
};
+ if ( $.isArray( page ) ) {
+ params.titles = page.join( '|' );
+ } else {
+ // The 'title' parameter is deprecated, keeping this for compatibility instead of
+ // converting to array because the API response changes from object to array of objects
+ // as well (bug 62422).
+ params.title = String( page );
+ }
+
if ( addParams ) {
$.extend( params, addParams );
}