Consolidate free-plan detection in the seats and billings frontend
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Free-plan detection is done three different ways across the seats and billings
code. Now that GET /namespaces/:id/gitlab_subscription always reports a plan
code of free for namespaces with no subscription row, these can be lined up.
Low urgency. The flaky spec this surfaced through is already fixed.
1. Unreachable branch in subscription_seats_statistics_card.vue
seatsStatisticsText checks hasFreePlan before hasLimitedFreePlan. With the
API reporting free correctly, the hasLimitedFreePlan branch that returns
"Seats in use / Seats available" can no longer be reached for a free group. Either
remove that branch or reorder the checks. Which one is right is a copy decision,
not a technical one.
2. Two flags describing one group, same file
The label comes from hasFreePlan. The denominator, totalSeatsInSubscription,
comes from hasLimitedFreePlan. When those disagreed, the card showed a label that
contradicted the number next to it. Worth collapsing to a single notion of free.
3. Mismatched checks in getters.js
In ee/app/assets/javascripts/billings/subscriptions/store/getters.js, isFreePlan
treats both 'free' and null as free. tableKey checks only code === null. So
a namespace with a real free subscription row already takes a different branch than
one without. Now that the API always reports free, tableKey should use the same
notion of free as isFreePlan.