Page MenuHomePhabricator

Allow VE plugins to handle save errors generated by extensions
Closed, ResolvedPublic

Description

(filing a task for work that Ed has already done to flag it for review and QA)

We should make it possible for VE plugins to handle save errors generated by extensions. Currently we have custom code to handle ConfirmEdit (CAPTCHA), SpamBlacklist and AbuseFilter errors.

Event Timeline

I think the work on this was triggered by a third-party patch https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/474619 "Support recaptcha for visual editor" – while we were kind of unhappy about having code to handle the CAPTCHA used on Wikimedia wikis in VE, also adding the code to support Google's reCAPTCHA was completely out of the question (on Wikimedia wikis, we don't want to load code that calls out to other sites, even if we don't use it, since that would make it too easy to accidentally enable it and violate our privacy policy). So Ed worked on the framework to allow that code to be written in the extension rather than in VE.

Relevant patches, chronologically:
(patches in each row were dependent on each other and merged at the same time)

mw/ext/VisualEditormw/ext/ConfirmEditmw/ext/SpamBlacklistmw/ext/AbuseFilter
7bd58c52a5ba: Move extension save error handlers into a registry
f0295ee01c4c: Remove captcha handler, moved to ConfirmEdit extension1f0d20306551: Move VE's ConfirmEdit support to this extension
041e7b77a1cb: Create SaveErrorHandler class to better define structure057db3d77ade: VE: Convert to SaveErrorHandler
103a34bb7558: Remove AbuseFilter & SpamBlacklist code687106d8af6b: Bring in VE support from VE extension02ada1b4f258: Move in VE support code from the VE extension

We should also follow-up on the fact we have a bunch of hard-coded events in ArticleTargetEvents that we use for tracking (e.g. saveErrorCaptcha)

QA notes: try to make an edit that will fail to save because of an error generated by ConfirmEdit (CAPTCHA) / SpamBlacklist / TitleBlacklist / AbuseFilter; make sure the error is shown correctly (as before).

matmarex edited projects, added Skipped QA; removed Editing QA.

I've been doing some work in related code (T211241, T211443) and I can confirm that this still works, we should just close this task already.