ArticleTargetSaver: Fix error messages

Follow-up to 5f1c68945d, which renamed
these messages while moving them into MediaWiki core.

Also, parse HTML in them. This is consistent with real API error
messages, and with the behavior of mw.Api#getErrorMessage. (And also
fixes potential HTML escaping issues.)

Change-Id: I307ca9873e245169a0d4b43499317acbac69fb9b
This commit is contained in:
Bartosz Dziewoński 2020-02-12 21:55:48 +01:00
parent 1a426d8614
commit 6d993fee49
2 changed files with 4 additions and 3 deletions

View file

@ -341,6 +341,7 @@
"dependencies": [
"ext.visualEditor.track",
"ext.visualEditor.core.utils.parsing",
"mediawiki.jqueryMsg",
"mediawiki.String",
"jquery.textSelection",
"mediawiki.api",

View file

@ -254,7 +254,7 @@
if ( !data ) {
error = {
code: 'invalidresponse',
html: mw.msg( 'visualeditor-error-invalidresponse' )
html: mw.message( 'api-clientside-error-invalidresponse' ).parse()
};
} else if ( data.result !== 'success' ) {
// This should only happen when saving an edit and getting a captcha from ConfirmEdit
@ -268,7 +268,7 @@
if ( typeof data.content !== 'string' ) {
error = {
code: 'invalidcontent',
html: mw.msg( 'visualeditor-error-invalidcontent' )
html: mw.message( 'api-clientside-error-invalidresponse' ).parse()
};
}
break;
@ -276,7 +276,7 @@
if ( typeof data.diff !== 'string' ) {
error = {
code: 'invalidcontent',
html: mw.msg( 'visualeditor-error-invalidcontent' )
html: mw.message( 'api-clientside-error-invalidresponse' ).parse()
};
}
break;