MessagePoster followup: Dependency and docs
authorMatthew Flaschen <mflaschen@wikimedia.org>
Mon, 6 Apr 2015 23:31:54 +0000 (16:31 -0700)
committerMatthew Flaschen <mflaschen@wikimedia.org>
Mon, 6 Apr 2015 23:58:07 +0000 (16:58 -0700)
* WikitextMessagePoster depends on mediawiki.messagePoster
* Tweak how promises are documented

Change-Id: Ie48bde9d5995e86f22744d6b6f3773d125ccb1b0

resources/Resources.php
resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js
resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js

index cbe6b82..e56d557 100644 (file)
@@ -974,6 +974,7 @@ return array(
                ),
                'dependencies' => array(
                        'mediawiki.api.edit',
+                       'mediawiki.messagePoster',
                ),
                'targets' => array( 'desktop', 'mobile' ),
        ),
index b021558..91366ff 100644 (file)
         *   by MessagePosters that require one, unless the message already contains the string
         *   ~~~.
         * @return {jQuery.Promise} Promise completing when the post succeeds or fails.
-        * @return {Function} return.done
-        * @return {Function} return.fail
-        * @return {string} return.fail.primaryError Primary error code.  For a mw.Api failure,
-        *   this should be 'api-fail'.
-        * @return {string} return.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.
-        * @return {Mixed} return.fail.details Further details about the error
+        *   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
index 098bc88..9d28080 100644 (file)
         * API and ResourceLoader requests in the background.
         *
         * @param {mw.Title} title Title that will be posted to
-        * @return {jQuery.Promise} Promise for the MessagePoster
-        * @return {Function} return.done Called if MessagePoster is retrieved
-        * @return {mw.messagePoster.MessagePoster} return.done.poster MessagePoster
-        * @return {Function} return.fail Called if MessagePoster could not be constructed
-        * @return {string} return.fail.errorCode String error code
+        * @return {jQuery.Promise} Promise resolving to a mw.messagePoster.MessagePoster.
+        *   For failure, rejected with up to three arguments:
+        *
+        *   - errorCode Error code string
+        *   - error Error explanation
+        *   - details Further error details
         */
        MwMessagePosterFactory.prototype.create = function ( title ) {
                var pageId, page, contentModel, moduleName,