Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/73964


Change subject: mw.ViewPageTarget: Add support for spam blacklist
......................................................................

mw.ViewPageTarget: Add support for spam blacklist

Bug: 50826
Change-Id: Icdc2730e5fc644c9030a6648702e071934f5ad62
---
M VisualEditor.php
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
2 files changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/64/73964/1

diff --git a/VisualEditor.php b/VisualEditor.php
index 679f77e..7485147 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -218,6 +218,8 @@
                        // MW core messages
                        'creating',
                        'editing',
+                       'spamprotectionmatch',
+                       'spamprotectiontext',
 
                        // Messages needed by VE in init phase only (rest go 
below)
                        'visualeditor-loadwarning',
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 1ede8fc..1ae7d0f 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -453,6 +453,21 @@
                return;
        }
 
+       editApi = data && data.visualeditoredit && data.visualeditoredit.edit;
+
+       // Handle spam blacklist error (either from core or from 
Extension:SpamBlacklist)
+       if ( editApi && editApi.spamblacklist ) {
+               this.showMessage(
+                       'api-save-error',
+                       ve.msg( 'spamprotectiontext' ) + ' ' + ve.msg( 
'spamprotectionmatch', editApi.spamblacklist ),
+                       {
+                               wrap: 'error'
+                       }
+               );
+               this.saveDialogSaveButton.setDisabled( true );
+               return;
+       }
+
        // Handle token errors
        if ( data.error && data.error.code === 'badtoken' ) {
                api = new mw.Api();
@@ -551,7 +566,6 @@
        // "question" or "fancy" type of captcha. They all expose differently 
named properties in the
        // API for different things in the UI. At this point we only support 
the FancyCaptha which we
        // very intuitively detect by the presence of a "url" property.
-       editApi = data && data.visualeditoredit && data.visualeditoredit.edit;
        if ( editApi && editApi.captcha && editApi.captcha.url ) {
                this.captcha = {
                        input: new ve.ui.TextInputWidget(),

-- 
To view, visit https://gerrit.wikimedia.org/r/73964
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icdc2730e5fc644c9030a6648702e071934f5ad62
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to