From 6d993fee49be29cb223714a0a6c83b4a5526b9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Wed, 12 Feb 2020 21:55:48 +0100 Subject: [PATCH] ArticleTargetSaver: Fix error messages Follow-up to 5f1c68945d39eb5daaf44c21b1475e264273f79a, 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 --- extension.json | 1 + modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extension.json b/extension.json index 01a35ecf3a..9ac2f1c054 100644 --- a/extension.json +++ b/extension.json @@ -341,6 +341,7 @@ "dependencies": [ "ext.visualEditor.track", "ext.visualEditor.core.utils.parsing", + "mediawiki.jqueryMsg", "mediawiki.String", "jquery.textSelection", "mediawiki.api", diff --git a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js index 8e6a01a4a9..147fca9505 100644 --- a/modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js +++ b/modules/ve-mw/preinit/ve.init.mw.ArticleTargetSaver.js @@ -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;