mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 02:38:40 +00:00
Support QuestyCaptcha and (kind of) MathCaptcha
MathCaptcha just extends SimpleCaptcha, so 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. Bug: 64328 Change-Id: I98312f61471667e7c4dcf715295f85642c31a688
This commit is contained in:
parent
62e07f8008
commit
94b5c8dfa5
|
@ -703,10 +703,12 @@ $wgResourceModules += array(
|
|||
'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' ),
|
||||
),
|
||||
|
|
|
@ -556,13 +556,22 @@ ve.init.mw.ViewPageTarget.prototype.onSaveErrorCaptcha = function ( editApi ) {
|
|||
$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>',
|
||||
editApi.captcha.question
|
||||
);
|
||||
}
|
||||
|
||||
$captchaDiv.append( this.captcha.input.$element );
|
||||
this.showSaveError( $captchaDiv, false );
|
||||
this.events.trackSaveError( 'captcha' );
|
||||
|
|
|
@ -657,7 +657,12 @@ ve.init.mw.Target.prototype.onSaveError = function ( jqXHR, status, data ) {
|
|||
// "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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue