Skip to content

feat: require an organization name on edit and make memberships editable - #217

Merged
Bccorb merged 1 commit into
mainfrom
feat/organization-management
Jul 30, 2026
Merged

feat: require an organization name on edit and make memberships editable#217
Bccorb merged 1 commit into
mainfrom
feat/organization-management

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Closes #143. Partially addresses #159 (see below).

Empty organization name (#143)

handleSubmit sent editName.trim() with no check, and the save control was not disabled for an empty value, so clearing the field and saving wrote an empty name and left the organization unidentifiable in every list. The create form already guarded this.

The edit form now matches it: submission is refused, the field is marked invalid with an inline message, and save is disabled.

Membership management (#159)

Constrained role selector. Member roles were free-form comma-separated text with no validation, so a typo was accepted silently and a mistyped role simply grants nothing. Roles now come from useRoles(), the same source the user dialogs use, so only roles the instance defines can be submitted.

Editing an existing membership. useUpdateOrganizationMember already existed but nothing in the interface called it, so changing someone's role meant removing and re-adding them, which discarded their membership history. There is now an Edit action on each member row opening a dialog for roles and scopes. It reuses the shared Dialog and RoleChips rather than adding a second modal or a second role control.

Search. The organization list has a search field over name and slug.

What is not in this PR, and why

The issue also asks for organization deletion and pagination on the list. Neither is here:

  • useOrganizations exposes no delete mutation, and I could not confirm from this repo that a DELETE /admin/organizations/:id route exists on the API or is forwarded by the server adapter. AGENTS.md is explicit that destructive admin mutations must be checked against the upstream API and the adapter together before the dashboard calls them, and a delete that 404s after a confirmation dialog is worse than no delete.
  • GET /admin/organizations is called with no parameters and I have no evidence it accepts limit/offset. The search here therefore filters the loaded page and there is a comment saying so, rather than a pager that appears to work and silently does nothing.

I have left #159 open. Confirm the delete route and the list parameters (or point me at the API repo) and I will finish both in a follow-up.

Checks

npm run lint, npm run typecheck, npm run format:check, and npm test all pass (397 tests). New cases: only instance-defined roles offered, the empty-name guard, and the list filter. The existing add-member test moved from typing "admin, member" into a text field to selecting from the constrained control, which is the fix landing.

The organization edit form submitted the name without checking it was non-empty
and its save control was not disabled for an empty value, so clearing the field
and saving wrote an empty name straight through and left the organization
unidentifiable in every list. The create form already guarded this. The edit form
now matches it, reports the problem inline, and disables save.

Member roles come from a constrained selector built from the roles the instance
actually defines, replacing free-form comma-separated text. A typo was previously
accepted silently, and a mistyped role simply grants nothing.

An existing membership can be edited in place through the update hook that
already existed but had no interface. Changing someone's role previously meant
removing and re-adding them, which discarded their membership history and invited
mistakes. The dialog reuses the shared Dialog and RoleChips rather than adding a
new modal or a second role control.

The organization list has a search field. It filters what the feed returned
rather than querying the server, and says so in a comment, because
GET /admin/organizations takes no search parameter.

Organization deletion and server-side pagination are not included. Neither has a
verifiable endpoint from this repo, and a control that appears to work while
doing nothing is worse than its absence. #159 stays open for those two.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Organization name can be cleared and saved empty

1 participant