Page MenuHomePhabricator

Collaborative contributions disabled if event criteria not met
Closed, ResolvedPublic3 Estimated Story Points

Description

Acceptance Criteria:

  • Given that a user is on Special:EnableEventRegistration or Special:EditEventRegistration,
    • They should have the checkbox as default disabled for Collaborative Contributions if and only if the conditions for enabling collaborative contributions are not met
      • Which means: not a contribution event (i.e., not editing event, media upload event, backlog drive, contest), no target wiki, and/or in person/hybrid in a "high risk" or no publish country (see T402353)

Event Timeline

ifried set the point value for this task to 3.

(Note: disable-if does not support arrays with in_array-style checks, so we may need to build a list of A === X OR A === Y ... manually.)

Change #1194250 had a related patch set uploaded (by Mhorsey; author: Mhorsey):

[mediawiki/core@master] Allow HTMLForm hide-if and disable-if to read values from multiselect fields Add new "IN" operator to handle fields with array values

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

Change #1194581 had a related patch set uploaded (by Mhorsey; author: Mhorsey):

[mediawiki/extensions/CampaignEvents@master] Disable collaborative contributions if prerequisites are not met

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

@ifried @JFernandez-WMF Hi! As I was reviewing this, I noticed that even if the toggle is disabled (greyed out), its value (on or off) is still used. In hindsight, this makes total sense because you can have inputs that are "on" and can't be toggled off by the user; I hinted at this possibility in a call but forgot to follow up here or elsewhere checking if it were actually the case. As an alternative to disabling the field, we can hide it instead, same as how the address field (for example) is dynamically hidden/displayed when you select different participation options. Would that work?

@ifried @JFernandez-WMF Hi! As I was reviewing this, I noticed that even if the toggle is disabled (greyed out), its value (on or off) is still used. In hindsight, this makes total sense because you can have inputs that are "on" and can't be toggled off by the user; I hinted at this possibility in a call but forgot to follow up here or elsewhere checking if it were actually the case. As an alternative to disabling the field, we can hide it instead, same as how the address field (for example) is dynamically hidden/displayed when you select different participation options. Would that work?

This is counter to how HTML forms should work, disabled fields shouldn't be included in the form submission

@ifried @JFernandez-WMF Hi! As I was reviewing this, I noticed that even if the toggle is disabled (greyed out), its value (on or off) is still used. In hindsight, this makes total sense because you can have inputs that are "on" and can't be toggled off by the user; I hinted at this possibility in a call but forgot to follow up here or elsewhere checking if it were actually the case. As an alternative to disabling the field, we can hide it instead, same as how the address field (for example) is dynamically hidden/displayed when you select different participation options. Would that work?

This is counter to how HTML forms should work, disabled fields shouldn't be included in the form submission

Yes sorry, I got confused, and hide-if wouldn't help. I'll move this conversation to gerrit, but my previous comment can be disregarded.

There appears to be a bug with the OOUI toggle input which doesn’t correctly respect the disabled state.

I can see 2 potential solutions:

Fix the OOUI component
Use a checkbox instead

As OOUI is deprecated, I expect that the former is not preferred. so I’m picking the latter for now, please voice any objections. Particularly @ifried and @JFernandez-WMF

@MHorsey-WMF, yes, a checkbox works. I agree that this approach is preferable, as OOUI is deprecated. I can update the ticket. Thank you!

ifried renamed this task from Toggle off if conditions met/Toggle on if conditions met for Collaborative Contributions to Collaborative contributions disabled if event criteria not met.Oct 16 2025, 5:54 PM
ifried updated the task description. (Show Details)

Change #1194581 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Disable collaborative contributions if prerequisites are not met

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

vaughnwalters subscribed.
  • Given that a user is on Special:EnableEventRegistration or Special:EditEventRegistration,
    • ✅ They should have the checkbox as default disabled for Collaborative Contributions if and only if the conditions for enabling collaborative contributions are not met
      • Which means:
        • ✅ not a contribution event (i.e., not editing event, media upload event, backlog drive, contest),
          Screen Recording 2025-10-24 at 5.15.19 PM.gif (2,592×1,808 px, 1 MB)
          ✅ no target wiki
          Screen Recording 2025-10-24 at 5.17.57 PM.gif (2,592×1,808 px, 1 MB)
          ✅ and/or in person/hybrid in a "high risk" or no publish country (see T402353)
          Screen Recording 2025-10-24 at 5.20.01 PM.gif (2,592×1,808 px, 1 MB)

Also, functioning correctly with JS disabled:

no target wikinot a contribution event"high risk" or no publish country
{F67080703}
Screenshot 2025-10-24 at 5.24.18 PM.png (1,640×520 px, 85 KB)
Screenshot 2025-10-24 at 5.25.57 PM.png (1,556×542 px, 75 KB)

All AC met, nice work 🎉 sending to product sign off.