Improve admin user approvals UX and guard last admin#98
Merged
RonaldRonnie merged 1 commit intomainfrom Jan 26, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I implemented now
Success/error toasts across admin user flows
Manual user creation (
/admin/users/create)Uses useToast to show:
Success toast: “User created – Temporary credentials have been generated.”
Error toast: “
Failed to create user”with server error description.Validation toast if no role is selected: “
Role required”.Pending registrations (
PendingRegistrationsTable)On approve:
Shows a success toast: “
User approved– The user account has been created successfully.”On error, shows a destructive toast with the backend error.
If role is missing, shows a destructive toast “Role required” and keeps the inline error message.
On reject:
Shows a success toast: “
Registration rejected.”Or destructive toast if the server returns an error.
Pending team members (
PendingTeamMembersTable)On approve:
Shows a success toast: “Team member approved – The user account has been created successfully.”
On error, shows a destructive toast with the backend error.
If role is missing, shows a destructive toast “
Role required”and keeps the inline error.Business rule: prevent removing the last active admin
In
ExistingUsersTablefor all admin-affecting actions:Update role:
Before calling
updateUserRole,checks how many active admins exist.If the target user is the only active admin and the new role is not admin, it:
Shows an inline error message.
Shows a toast: “Cannot change role – You cannot remove the last active admin. Create another admin first.”
If trying to disable the only active admin, it:
Shows a toast “Cannot disable user – You cannot disable the last active admin…”.
If trying to delete the only active admin, it:
Closes: #78