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 from initSetUserCapRadio when the number input is not on the page. The sibling seatControlTransition already 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

  1. 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.
  2. Open the group's Settings > General and expand Permissions and group features.
  3. Check the Seat control section shows only the restricted access notice.
  4. Open the DevTools console and check there is no reading 'value' TypeError.
  5. 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.

References

🤖 Generated with Claude Code

Merge request reports

Loading
Loading