Merge "mediawiki.widgets: Cleanup TitleWidget styles and improve API"
[lhc/web/wiklou.git] / resources / src / mediawiki.api / mediawiki.api.category.js
index 7dd9730..14077e0 100644 (file)
@@ -3,29 +3,21 @@
  */
 ( function ( mw, $ ) {
 
-       var msg = 'Use of mediawiki.api callback params is deprecated. Use the Promise instead.';
        $.extend( mw.Api.prototype, {
                /**
                 * Determine if a category exists.
                 *
                 * @param {mw.Title|string} title
-                * @param {Function} [ok] Success callback (deprecated)
-                * @param {Function} [err] Error callback (deprecated)
                 * @return {jQuery.Promise}
                 * @return {Function} return.done
                 * @return {boolean} return.done.isCategory Whether the category exists.
                 */
-               isCategory: function ( title, ok, err ) {
+               isCategory: function ( title ) {
                        var apiPromise = this.get( {
                                prop: 'categoryinfo',
                                titles: String( title )
                        } );
 
-                       if ( ok || err ) {
-                               mw.track( 'mw.deprecate', 'api.cbParam' );
-                               mw.log.warn( msg );
-                       }
-
                        return apiPromise
                                .then( function ( data ) {
                                        var exists = false;
@@ -38,8 +30,6 @@
                                        }
                                        return exists;
                                } )
-                               .done( ok )
-                               .fail( err )
                                .promise( { abort: apiPromise.abort } );
                },
 
                 * E.g. given "Foo", return "Food", "Foolish people", "Foosball tables"...
                 *
                 * @param {string} prefix Prefix to match.
-                * @param {Function} [ok] Success callback (deprecated)
-                * @param {Function} [err] Error callback (deprecated)
                 * @return {jQuery.Promise}
                 * @return {Function} return.done
                 * @return {string[]} return.done.categories Matched categories
                 */
-               getCategoriesByPrefix: function ( prefix, ok, err ) {
+               getCategoriesByPrefix: function ( prefix ) {
                        // Fetch with allpages to only get categories that have a corresponding description page.
                        var apiPromise = this.get( {
                                list: 'allpages',
                                apnamespace: mw.config.get( 'wgNamespaceIds' ).category
                        } );
 
-                       if ( ok || err ) {
-                               mw.track( 'mw.deprecate', 'api.cbParam' );
-                               mw.log.warn( msg );
-                       }
-
                        return apiPromise
                                .then( function ( data ) {
                                        var texts = [];
@@ -78,8 +61,6 @@
                                        }
                                        return texts;
                                } )
-                               .done( ok )
-                               .fail( err )
                                .promise( { abort: apiPromise.abort } );
                },
 
                 * Get the categories that a particular page on the wiki belongs to.
                 *
                 * @param {mw.Title|string} title
-                * @param {Function} [ok] Success callback (deprecated)
-                * @param {Function} [err] Error callback (deprecated)
-                * @param {boolean} [async=true] Asynchronousness (deprecated)
                 * @return {jQuery.Promise}
                 * @return {Function} return.done
                 * @return {boolean|mw.Title[]} return.done.categories List of category titles or false
                 *  if title was not found.
                 */
-               getCategories: function ( title, ok, err, async ) {
+               getCategories: function ( title ) {
                        var apiPromise = this.get( {
                                prop: 'categories',
                                titles: String( title )
-                       }, {
-                               async: async === undefined ? true : async
                        } );
 
-                       if ( ok || err ) {
-                               mw.track( 'mw.deprecate', 'api.cbParam' );
-                               mw.log.warn( msg );
-                       }
-                       if ( async !== undefined ) {
-                               mw.track( 'mw.deprecate', 'api.async' );
-                               mw.log.warn(
-                                       'Use of mediawiki.api async=false param is deprecated. ' +
-                                       'The sychronous mode will be removed in the future.'
-                               );
-                       }
-
                        return apiPromise
                                .then( function ( data ) {
                                        var titles = false;
                                        }
                                        return titles;
                                } )
-                               .done( ok )
-                               .fail( err )
                                .promise( { abort: apiPromise.abort } );
                }
        } );