Skip user cap radio setup when the cap input is absent
What does this MR do and why?
Fixes an uncaught TypeError in the Seat control section of the group settings page (Settings > General > Permissions and group features). EE only.
ee/app/views/groups/_seat_control_setting.html.haml renders the #js-seat-control section for root groups with seat control available. When the subscription does not allow contract overages, the section contains only a notice paragraph about restricted access. It renders no radio buttons and no "Number of users for user cap" input.
initSetUserCapRadio in ee/app/assets/javascripts/groups/settings/permissions/index.js found the section, then read the value of the number input unconditionally. With the notice-only section the input is null, so the page entrypoint threw Uncaught TypeError: Cannot read properties of null (reading 'value').
In CI this logged the error in 2 examples of ee/spec/features/groups/group_settings_spec.rb (seat control settings, root group, contract overages not allowed).
Changes made:
ee/app/assets/javascripts/groups/settings/permissions/index.js— return early frominitSetUserCapRadiowhen the number input is not on the page. The siblingseatControlTransitionalready returns an empty array when there are no radios.ee/spec/frontend/groups/settings/permissions/index_spec.js— new block "when the subscription does not allow overages and only a notice is rendered" that mounts the notice-only section and asserts the init does not throw.
How to set up and validate locally
- In GDK with an Ultimate license, use a root group whose subscription has restricted access (contract overages not allowed). If you have none, temporarily make
contract_overages_allowed?return false. - Open the group's Settings > General and expand Permissions and group features.
- Check the Seat control section shows only the restricted access notice.
- Open the DevTools console and check there is no
reading 'value'TypeError. - For a group with overages allowed, check the user cap radio still enables and disables the number input.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- I have evaluated the MR acceptance checklist for this MR.
References
- Addresses one entry of #628901 (browser console error catalogue, section B)
- Errors surfaced by !255207 (closed) (feature specs fail on console errors)
- Sibling fixes from the same catalogue: !255305 (merged), !255309 (merged), !255311 (merged), !255313 (merged), !255315 (merged), !255316 (merged)