* Use errorformat for action=login Failed responses in non-BC mode.
* We removed 'messageHtml' from action=rollback's response on error, but
left it for success. Remove it there too, it's even less useful.
* We changed action=watch's reporting of errors, but left the
mostly-pointless reporting of "success" UI messages. These should be
handled on the client side.
Change-Id: Ia6c402a4254fbacf4c2c3f125ce8bf0bcc71e509
* action=revisiondelete no longer includes a "rendered" property on warnings
and errors for each item. Use errorformat=wikitext if you're wanting parsed
output.
-* action=rollback no longer returns a "messageHtml" property on errors. Use
- errorformat=html if you're wanting HTML formatting of messages.
+* action=rollback no longer returns a "messageHtml" property. Use
+ errorformat=html if you're wanting HTML formatting of error messages.
* action=upload now reports optional stash failures as an array under key
'stasherrors' rather than a 'stashfailed' text string.
-* action=watch reports 'errors' and 'warnings' instead of a single 'error'.
+* action=watch reports 'errors' and 'warnings' instead of a single 'error', and
+ no longer returns a 'message' on success.
=== Action API internal changes in 1.29 ===
* New methods were added to ApiBase to handle errors and warnings using i18n
break;
case 'Failed':
- $result['reason'] = ApiErrorFormatter::stripMarkup(
- $message->useDatabase( false )->inLanguage( 'en' )->text()
- );
+ $errorFormatter = $this->getErrorFormatter();
+ if ( $errorFormatter instanceof ApiErrorFormatter_BackCompat ) {
+ $result['reason'] = ApiErrorFormatter::stripMarkup(
+ $message->useDatabase( false )->inLanguage( 'en' )->text()
+ );
+ } else {
+ $result['reason'] = $errorFormatter->formatMessage( $message );
+ }
break;
case 'Aborted':
'last_revid' => intval( $details['target']->getID() )
];
- $oldUser = $details['current']->getUserText( Revision::FOR_THIS_USER );
- $lastUser = $details['target']->getUserText( Revision::FOR_THIS_USER );
- $diffUrl = $titleObj->getFullURL( [
- 'diff' => $info['revid'],
- 'oldid' => $info['old_revid'],
- 'diffonly' => '1'
- ] );
- $info['messageHtml'] = $this->msg( 'rollback-success-notify' )
- ->params( $oldUser, $lastUser, $diffUrl )
- ->parseAsBlock();
-
$this->getResult()->addValue( null, $this->getModuleName(), $info );
}
if ( $params['unwatch'] ) {
$status = UnwatchAction::doUnwatch( $title, $user );
$res['unwatched'] = $status->isOK();
- if ( $status->isOK() ) {
- $msgKey = $title->isTalkPage() ? 'removedwatchtext-talk' : 'removedwatchtext';
- $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() )
- ->title( $title )->parseAsBlock();
- }
} else {
$status = WatchAction::doWatch( $title, $user );
$res['watched'] = $status->isOK();
- if ( $status->isOK() ) {
- $msgKey = $title->isTalkPage() ? 'addedwatchtext-talk' : 'addedwatchtext';
- $res['message'] = $this->msg( $msgKey, $title->getPrefixedText() )
- ->title( $title )->parseAsBlock();
- }
}
if ( !$status->isOK() ) {
'mediawiki.api.watch',
'mediawiki.notify',
'mediawiki.util',
+ 'mediawiki.Title',
+ 'mediawiki.jqueryMsg',
'jquery.accessKeyLabel',
'mediawiki.RegExp',
],
'tooltip-ca-watch',
'tooltip-ca-unwatch',
'watcherrortext',
+ 'addedwatchtext',
+ 'addedwatchtext-talk',
+ 'removedwatchtext',
+ 'removedwatchtext-talk',
],
],
'mediawiki.page.rollback' => [
* parameter)
* @return {string} return.done.watch.title Full pagename
* @return {boolean} return.done.watch.watched Whether the page is now watched or unwatched
- * @return {string} return.done.watch.message Parsed HTML of the confirmational interface message
*/
function doWatchInternal( pages, addParams ) {
// XXX: Parameter addParams is undocumented because we inherit this
api[ action ]( title )
.done( function ( watchResponse ) {
- var otherAction = action === 'watch' ? 'unwatch' : 'watch';
-
- mw.notify( $.parseHTML( watchResponse.message ), {
+ var mwTitle, message, otherAction = action === 'watch' ? 'unwatch' : 'watch';
+
+ message = action === 'watch' ? 'addedwatchtext' : 'removedwatchtext';
+ mwTitle = mw.Title.newFromText( title );
+ if ( mwTitle && mwTitle.getNamespaceId() > 0 &&
+ /* eslint-disable no-bitwise */
+ ( mwTitle.getNamespaceId() & 1 ) === 1
+ /* eslint-enable no-bitwise */
+ ) {
+ message += '-talk';
+ }
+
+ mw.notify( mw.message( message, title ).parseDom(), {
tag: 'watch-self'
} );