Summary
We want to display ConfirmEdit (CAPTCHA extension) hCaptcha in VisualEditor and MobileFrontend, but in these situations we need to know this before they open the edit form. Therefore, a mw.config variable is needed to determine if hCaptcha needs to be shown
Background
- Both the VisualEditor and MobileFrontend integrations with hCaptcha need to know in advance whether the hCaptcha captcha needs to be shown for the edit to go through
- This is so that they can emulate the same behaviour as the wikitext editor has, where if we know in a general sense that a hCaptcha captcha needs to be done it will be shown once they open the edit form
- Because these forms can be opened without a refresh of the page, we will need to set some value that exists even on reads. This could therefore be a JS configuration variable.
- This JS configuration variable needs to contain:
- Whether a captcha needs to be completed
- What kind of captcha needs to be completed
- This JS configuration variable needs to contain:
- Using a combined variable for both the VisualEditor and MobileFrontend integrations will help to reduce the overall number of JS configuration variables and reduce the impact this has on page load times
Technical notes
- Some JS configuration variable like wgConfirmEditCaptchaNeededForEdit would be defined
- It could be unset if it's not needed (i.e. VisualEditor and MobileFrontend could not be used on the given page view) and unset if a captcha is not required for a generic edit
- If it is needed, then the value should be the type of captcha that is required (i.e. hcaptcha if hCaptcha is needed and fancycaptcha if FancyCaptcha is needed)
- We can determine this through a call to Hooks::getInstance( 'edit' )->shouldCheck() which will return whether a captcha is needed for the edit. We would check the instance returned by Hooks::getInstance( 'edit' ) to determine what type of captcha is being returned
Acceptance criteria
- A way to know whether a captcha is needed for the VisualEditor / MobileFrontend interfaces when the edit forms open is added