Follow-up: show warning when adding user to group that incur a charge
This issue is a follow-up to MVC: Show transparent warnings when adding a user to a group will incur a charge.
Problem
When the user is adding members to their group we're presenting them a confirmation modal that adding more users will incur a charge, however, we're not checking if the members being added are already part of the subscription (already members of the current group or members of a sub-group).
Proposal
Do a check on the invite button click, which will validate the current users being added against the subscription, then decide if adding those users will make the subscription go above its max users or not.
The checking on users needs to count for users who are part of the subscription (e.g. in a sub-group or a parent group).
When the user clicks the "invite" button, we need to show a loading spinner and disable the button while the request is being made, then based on the response we either show a confirmation modal or submit the form regularly.
API endpoint specs
The endpoint will receive:
- users ids: comma-separated list of users as numbers (it contain emails for when the user will invite a member by email).
- Group ID that the users are being added to.
The endpoint should return a boolean indicating if the user will increase their max seats by adding those users or not (which will tell us whether to show the warning modal or not, accordingly).