summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js
blob: 91366ff5933e199310ab1beb18705bd05d8e3d44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*global OO*/
( function ( mw ) {
	/**
	 * This is the abstract base class for MessagePoster implementations.
	 *
	 * @abstract
	 * @class
	 *
	 * @constructor
	 * @param {mw.Title} title Title to post to
	 */
	mw.messagePoster.MessagePoster = function MwMessagePoster() {};

	OO.initClass( mw.messagePoster.MessagePoster );

	/**
	 * Post a message (with subject and body) to a talk page.
	 *
	 * @param {string} subject Subject/topic title; plaintext only (no wikitext or HTML)
	 * @param {string} body Body, as wikitext.  Signature code will automatically be added
	 *   by MessagePosters that require one, unless the message already contains the string
	 *   ~~~.
	 * @return {jQuery.Promise} Promise completing when the post succeeds or fails.
	 *   For failure, will be rejected with three arguments:
	 *
	 *   - primaryError - Primary error code.  For a mw.Api failure,
	 *       this should be 'api-fail'.
	 *   - secondaryError - Secondary error code.  For a mw.Api failure,
	 *       this, should be mw.Api's code, e.g. 'http', 'ok-but-empty', or the error passed through
	 *       from the server.
	 *   - details - Further details about the error
	 *
	 * @localdoc
	 * The base class currently does nothing, but could be used for shared analytics or
	 * something.
	 */
	mw.messagePoster.MessagePoster.prototype.post = function () {};
}( mediaWiki ) );