From: Matthew Flaschen Date: Mon, 6 Apr 2015 23:31:54 +0000 (-0700) Subject: MessagePoster followup: Dependency and docs X-Git-Tag: 1.31.0-rc.0~11825^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=d49ea1bb8e142ceba954a5eefde3c89fdbff1514;p=lhc%2Fweb%2Fwiklou.git MessagePoster followup: Dependency and docs * WikitextMessagePoster depends on mediawiki.messagePoster * Tweak how promises are documented Change-Id: Ie48bde9d5995e86f22744d6b6f3773d125ccb1b0 --- diff --git a/resources/Resources.php b/resources/Resources.php index cbe6b82e6f..e56d5577c6 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -974,6 +974,7 @@ return array( ), 'dependencies' => array( 'mediawiki.api.edit', + 'mediawiki.messagePoster', ), 'targets' => array( 'desktop', 'mobile' ), ), diff --git a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js index b021558193..91366ff593 100644 --- a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js +++ b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js @@ -21,14 +21,14 @@ * 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 diff --git a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js index 098bc88075..9d280800bd 100644 --- a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js +++ b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js @@ -50,11 +50,12 @@ * 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,