X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki.messagePoster.wikitext%2FWikitextMessagePoster.js;h=e87f8a740c36550d82a889faa3c93cfa85396abc;hb=6cfb2e3d7a2b96d5041312fcec88248bb46573d7;hp=20621d2fa4820f6f18560957b2ebc2c4f88426c0;hpb=ac0ab2c03a12756b0965f250c174e228348ec459;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki.messagePoster.wikitext/WikitextMessagePoster.js b/resources/src/mediawiki.messagePoster.wikitext/WikitextMessagePoster.js index 20621d2fa4..e87f8a740c 100644 --- a/resources/src/mediawiki.messagePoster.wikitext/WikitextMessagePoster.js +++ b/resources/src/mediawiki.messagePoster.wikitext/WikitextMessagePoster.js @@ -21,20 +21,30 @@ /** * @inheritdoc + * @param {string} subject Section title. + * @param {string} body Message body, as wikitext. Signature code will automatically be added unless the message already contains the string ~~~. + * @param {Object} [options] Message options: + * @param {string} [options.tags] [Change tags](https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Tags) to add to the message's revision, pipe-separated. */ - WikitextMessagePoster.prototype.post = function ( subject, body ) { - mw.messagePoster.WikitextMessagePoster.parent.prototype.post.call( this, subject, body ); + WikitextMessagePoster.prototype.post = function ( subject, body, options ) { + var additionalParams; + options = options || {}; + mw.messagePoster.WikitextMessagePoster.parent.prototype.post.call( this, subject, body, options ); // Add signature if needed if ( body.indexOf( '~~~' ) === -1 ) { body += '\n\n~~~~'; } + additionalParams = { redirect: true }; + if ( options.tags !== undefined ) { + additionalParams.tags = options.tags; + } return this.api.newSection( this.title, subject, body, - { redirect: true } + additionalParams ).then( function ( resp, jqXHR ) { if ( resp.edit.result === 'Success' ) { return $.Deferred().resolve( resp, jqXHR );