Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / resources / src / mediawiki / api / rollback.js
blobcdc4dbf018b030c2edc182e233531c349aa23e13
1 /**
2  * @class mw.Api.plugin.rollback
3  * @since 1.28
4  */
5 ( function ( mw, $ ) {
7         $.extend( mw.Api.prototype, {
8                 /**
9                  * Convenience method for `action=rollback`.
10                  *
11                  * @param {string|mw.Title} page
12                  * @param {string} user
13                  * @param {Object} [params] Additional parameters
14                  * @return {jQuery.Promise}
15                  */
16                 rollback: function ( page, user, params ) {
17                         return this.postWithToken( 'rollback', $.extend( {
18                                 action: 'rollback',
19                                 title: String( page ),
20                                 user: user,
21                                 uselang: mw.config.get( 'wgUserLanguage' )
22                         }, params ) )
23                         .then( function ( data ) {
24                                 return data.rollback;
25                         } );
26                 }
27         } );
29         /**
30          * @class mw.Api
31          * @mixins mw.Api.plugin.rollback
32          */
34 }( mediaWiki, jQuery ) );