Skip to content

Fix user cap alert on non-namespace pages

Nicolas Dular requested to merge nd/fix-namespace-user-cap-alert into master

What does this MR do and why?

When a page is not within a namespace and we try to display the namespace user cap alert, we would receive an error for building the pending_members_group_usage_quotas_path.

We need to use .persisted? because by default, we build a new Namespace record and pass it along to the frontend.

Screenshots or screen recordings

Screenshot_2022-06-10_at_13.53.08

Screenshot_2022-06-10_at_13.52.46

How to set up and validate locally

  1. export GITLAB_SIMULATE_SAAS=1
  2. gdk start
  3. Enable free_user_cap as feature flag globally
    bin/rails c
    Feature.enable(:free_user_cap)
  4. Go to http://localhost:3000/groups/new
  5. See the error (without this fix)

Reason is that we reuse the user_cap_available?

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports