Alex Monk has uploaded a new change for review.

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

Change subject: Support QuestCaptcha and (kind of) MathCaptcha
......................................................................

Support QuestCaptcha and (kind of) MathCaptcha

MathCaptcha just extends SimpleCaptcha, its output is fine to show as text
Doing that because I'm not sure how to render TeX and this is a reasonable
fallback

Also tidy up the order of some message entries in my last commit

Change-Id: I98312f61471667e7c4dcf715295f85642c31a688
---
M VisualEditor.php
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve-mw/init/ve.init.mw.Target.js
3 files changed, 20 insertions(+), 4 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index a0ceb37..2a7a9cd 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -703,10 +703,12 @@
                        'toc',
 
                        'captcha-edit',
-                       // Only used if FancyCaptcha is installed and triggered 
on save
                        'captcha-label',
-                       'fancycaptcha-edit',
                        'colon-separator',
+                       // Only used if FancyCaptcha is installed and triggered 
on save
+                       'fancycaptcha-edit',
+                       // Only used if QuestyCaptcha is installed and 
triggered on save
+                       'questycaptcha-edit'
                ),
                'targets' => array( 'desktop', 'mobile' ),
        ),
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 b06c2d1..5331571 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -556,13 +556,22 @@
                $captchaDiv.append(
                        $( '<img>' ).attr( 'src', editApi.captcha.url )
                );
-       } else if ( editApi.captcha.type === 'simple' ) { // SimpleCaptcha
+       } else if ( editApi.captcha.type === 'simple' || editApi.captcha.type 
=== 'math' ) {
+               // SimpleCaptcha and MathCaptcha
                $captchaParagraph.append(
                        mw.message( 'captcha-edit' ).parse(),
                        '<br>',
                        document.createTextNode( editApi.captcha.question )
                );
+       } else if ( editApi.captcha.type === 'question' ) {
+               // QuestyCaptcha
+               $captchaParagraph.append(
+                       mw.message( 'questycaptcha-edit' ).parse(),
+                       '<br>',
+                       document.createTextNode( editApi.captcha.question )
+               );
        }
+
        $captchaDiv.append( this.captcha.input.$element );
        this.showSaveError( $captchaDiv, false );
        this.events.trackSaveError( 'captcha' );
diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index dbb8566..cee0c78 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -657,7 +657,12 @@
        // "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 SimpleCaptcha and FancyCaptcha
        // which we very intuitively detect by the presence of a "url" property.
-       if ( editApi && editApi.captcha && ( editApi.captcha.url || 
editApi.captcha.type === 'simple' ) ) {
+       if ( editApi && editApi.captcha && (
+               editApi.captcha.url ||
+               editApi.captcha.type === 'simple' ||
+               editApi.captcha.type === 'math' ||
+               editApi.captcha.type === 'question'
+       ) ) {
                this.emit( 'saveErrorCaptcha', editApi );
                return;
        }

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

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

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

Reply via email to