Page MenuHomePhabricator

hCaptcha VisualEditor: Execute hCaptcha when in invisible mode mode if hCaptcha widget shown before first "Save changes" attempt
Closed, ResolvedPublic3 Estimated Story Points

Description

Summary

Now that we have displayed hCaptcha in the VisualEditor interface where possible during the first time the user opens the window, we should look to programmatically cause execution of hCaptcha when a user presses "Save changes" to complete the edit

Background

Acceptance criteria

  • When a user opens the VisualEditor "Publish changes" dialog and presses "Publish changes", any invisible hCaptcha widget displayed is executed as long as it was rendered before the first attempt to press "Publish changes" was made

Related Objects

Event Timeline

Dreamy_Jazz set the point value for this task to 1.Oct 14 2025, 2:10 PM
Dreamy_Jazz changed the point value for this task from 1 to 3.Nov 28 2025, 2:03 PM

After looking over this ticket, it seems to be a much larger ticket than previously expected.

We need a way to able to halt or prevent edit submission in VisualEditor so the hCaptcha can execute. Then we need a way to either continue or restart the edit submission with the hCaptcha token once it has finished. This doesn't appear to be possible with the current VisualEditor hooks, so likely work will be needed in VisualEditor to support this.

Proposal from @DLynch:

If you wanted to just duplicate the current getPreSaveProcess methodology with a getSaveOptionsProcess that’s passed saveOptions to modify, that’d probably be most-fitting

Change #1217263 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/VisualEditor@master] [WIP] Add ve.init.mw.ArticleTarget.getSaveOptionsProcess

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

Change #1217479 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ConfirmEdit@master] [Very WIP] Execute hCaptcha on VisualEditor form submission

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

(first patch is awaiting review and the second is having some details discussed internally)

Change #1217263 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Add ve.init.mw.ArticleTarget.getSaveOptionsProcess

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

Change #1268667 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ConfirmEdit@master] hCaptcha VisualEditor: Move rendering to ve.init.mw.HCaptcha.js

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

Change #1268670 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ConfirmEdit@master] hCaptcha VisualEditor: Render hCaptcha privacy policy in save error handler

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

Change #1268667 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha VisualEditor: Move rendering to ve.init.mw.HCaptcha.js

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

Change #1268925 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/ConfirmEdit@master] hCaptcha VisualEditor: Mark hCaptcha as invisible if configured so

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

Change #1268670 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha VisualEditor: Render hCaptcha privacy policy in save error handler

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

Change #1217479 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] Execute hCaptcha on VisualEditor form submission

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

Change #1268925 merged by jenkins-bot:

[mediawiki/extensions/ConfirmEdit@master] hCaptcha VisualEditor: Mark hCaptcha as invisible if configured so

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

I don't fully understand this change. However, I have certainly seen the hCaptcha loading both on initial click of "Publish changes" and on the second click (after you have seen the "Please resubmit..." message). @Dreamy_Jazz Is there anything else?

Dreamy_Jazz updated the task description. (Show Details)

I don't fully understand this change. However, I have certainly seen the hCaptcha loading both on initial click of "Publish changes" and on the second click (after you have seen the "Please resubmit..." message). @Dreamy_Jazz Is there anything else?

This task was for the "hCaptcha loading both on initial click of "Publish changes"", so going to take this is done for QA