Merge "user: Allow "CAS update failed" exceptions to be normalised"
[lhc/web/wiklou.git] / resources / src / mediawiki.messagePoster / MessagePoster.js
1 ( function () {
2 /**
3 * This is the abstract base class for MessagePoster implementations.
4 *
5 * @abstract
6 * @class
7 *
8 * @constructor
9 * @param {mw.Title} title Title to post to
10 */
11 mw.messagePoster.MessagePoster = function MwMessagePoster() {};
12
13 OO.initClass( mw.messagePoster.MessagePoster );
14
15 /**
16 * Post a message (with subject and body) to a talk page.
17 *
18 * @abstract
19 * @param {string} subject Subject/topic title. The amount of wikitext supported is
20 * implementation-specific. It is recommended to only use basic wikilink syntax for
21 * maximum compatibility.
22 * @param {string} body Body, as wikitext. Signature code will automatically be added
23 * by MessagePosters that require one, unless the message already contains the string
24 * ~~~.
25 * @return {jQuery.Promise} Promise completing when the post succeeds or fails.
26 * For failure, will be rejected with three arguments:
27 *
28 * - primaryError - Primary error code. For a mw.Api failure,
29 * this should be 'api-fail'.
30 * - secondaryError - Secondary error code. For a mw.Api failure,
31 * this, should be mw.Api's code, e.g. 'http', 'ok-but-empty', or the error passed through
32 * from the server.
33 * - details - Further details about the error
34 *
35 * @localdoc
36 * The base class currently does nothing, but could be used for shared analytics or
37 * something.
38 */
39 mw.messagePoster.MessagePoster.prototype.post = function () {};
40 }() );