Parse SpamBlacklist error on the server-side

The client won't be able to deal with templates etc.

Bug: T99830
Change-Id: I78611a3f061b1afd73de052aa9ddff48dc368f2d
This commit is contained in:
Alex Monk 2015-06-30 16:28:35 +01:00 committed by Jforrester
parent 31e45cf530
commit 82fb5f609a
3 changed files with 8 additions and 6 deletions

View file

@ -158,6 +158,13 @@ class ApiVisualEditorEdit extends ApiVisualEditor {
'edit' => $saveresult['edit']
);
if ( isset( $saveresult['edit']['spamblacklist'] ) ) {
$matches = explode( '|', $saveresult['edit']['spamblacklist'] );
$matcheslist = $this->getLanguage()->listToText( $matches );
$result['edit']['sberrorparsed'] = $this->msg( 'spamprotectiontext' )->parse() . ' ' .
$this->msg( 'spamprotectionmatch', $matcheslist )->parse();
}
// Success
} else {
if ( isset( $saveresult['edit']['newrevid'] ) ) {

View file

@ -319,8 +319,6 @@
"lastmodifiedat",
"parentheses",
"redirectpagesub",
"spamprotectionmatch",
"spamprotectiontext",
"summary-preview",
"fancycaptcha-reload-text",
"visualeditor-loadwarning",

View file

@ -695,10 +695,7 @@ ve.init.mw.ViewPageTarget.prototype.onSaveErrorEmpty = function () {
*/
ve.init.mw.ViewPageTarget.prototype.onSaveErrorSpamBlacklist = function ( editApi ) {
this.showSaveError(
ve.msg( 'spamprotectiontext' ) + ' ' +
ve.msg(
'spamprotectionmatch', mw.language.listToText( editApi.spamblacklist.split( '|' ) )
),
$( $.parseHTML( editApi.sberrorparsed ) ),
false // prevents reapply
);
};