Page MenuHomePhabricator

DiscussionTools hCaptcha: Show hCaptcha widget before first reply attempt
Open, Needs TriagePublic

Description

Summary

hCaptcha will be required for all DiscussionTools edits on WMF wiks and so to avoid a double-submit for the user we should render the hCaptcha CAPTCHA widget before the user makes their first edit attempt via the tool

Background

  • On WMF wikis, hCaptcha will be required for all edits
    • This means that several interfaces (like VisualEditor) have been updated to show the hCaptcha CAPTCHA widget before the first edit attempt when all edits need hCaptcha
  • Knowing if all edits require hCaptcha is done by checking if hCaptcha is needed to edit the current page without including any content in that check
    • The result of this is available through the mw.libs.confirmEdit.CaptchaWidget.static.captchaNeededForEdit method, which returns the type of CAPTCHA needed to make a "generic" edit (a generic edit represents that any edit to the page would need a CAPTCHA, ignoring any extra rules that may be based on the content of the page or the newly added content)
  • We should make DiscussionTools render the CAPTCHA widget if we know that it would be required for a "generic" edit
    • Some CAPTCHAs need specific data that is only returned after a failed response, such as #fancycaptcha. This means that we should for now only make DiscussionTools render the CAPTCHA if the CAPTCHA type is hCaptcha (as this can be rendered without having first attempted to make the edit)

Acceptance criteria

  • DiscussionTools renders the hCaptcha CAPTCHA before the first edit submission attempt if hCaptcha is required for a "generic" edit

Event Timeline

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

[mediawiki/extensions/DiscussionTools@master] [WIP] Show CAPTCHA if required for all edits before first edit attempt

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

Change #1285842 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Show CAPTCHA if required for all edits before first edit attempt

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

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

[mediawiki/extensions/DiscussionTools@master] Make DiscussionTools not show hCaptcha initially unless configured

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

Change #1286292 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/DiscussionTools@master] tests: Don't assume CaptchaWidget is defined in setInitialCaptcha tests

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

Change #1286292 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] tests: Don't assume CaptchaWidget is defined in setInitialCaptcha tests

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

Change #1286285 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Make DiscussionTools not show hCaptcha initially unless configured

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

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

[mediawiki/extensions/DiscussionTools@wmf/1.47.0-wmf.2] Show CAPTCHA if required for all edits before first edit attempt

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

Change #1286324 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@wmf/1.47.0-wmf.2] Show CAPTCHA if required for all edits before first edit attempt

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

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

[mediawiki/extensions/DiscussionTools@wmf/1.47.0-wmf.2] Make DiscussionTools not show hCaptcha initially unless configured

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

Change #1286328 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@wmf/1.47.0-wmf.2] Make DiscussionTools not show hCaptcha initially unless configured

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

Mentioned in SAL (#wikimedia-operations) [2026-05-12T12:15:52Z] <dreamyjazz@deploy1003> Started scap sync-world: Backport for [[gerrit:1286328|Make DiscussionTools not show hCaptcha initially unless configured (T425955)]], [[gerrit:1286324|Show CAPTCHA if required for all edits before first edit attempt (T425955)]], [[gerrit:1286322|hCaptcha: Enable for DiscussionTools on testwiki (T426039)]], [[gerrit:1286318|hCaptcha: Enable for VisualEditor and MobileFrontend mediawikiwiki (T425

Mentioned in SAL (#wikimedia-operations) [2026-05-12T12:17:43Z] <dreamyjazz@deploy1003> dreamyjazz: Backport for [[gerrit:1286328|Make DiscussionTools not show hCaptcha initially unless configured (T425955)]], [[gerrit:1286324|Show CAPTCHA if required for all edits before first edit attempt (T425955)]], [[gerrit:1286322|hCaptcha: Enable for DiscussionTools on testwiki (T426039)]], [[gerrit:1286318|hCaptcha: Enable for VisualEditor and MobileFrontend mediawikiwiki (T425940)]] synced

Mentioned in SAL (#wikimedia-operations) [2026-05-12T12:25:04Z] <dreamyjazz@deploy1003> Finished scap sync-world: Backport for [[gerrit:1286328|Make DiscussionTools not show hCaptcha initially unless configured (T425955)]], [[gerrit:1286324|Show CAPTCHA if required for all edits before first edit attempt (T425955)]], [[gerrit:1286322|hCaptcha: Enable for DiscussionTools on testwiki (T426039)]], [[gerrit:1286318|hCaptcha: Enable for VisualEditor and MobileFrontend mediawikiwiki (T42

This comment was removed by Dreamy_Jazz.