You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(dotcom): rename group admin role to member (tldraw#9029)
In order to make the group role label match what it actually represents,
this PR renames the non-owner group role from `admin` to `member`. The
role confers no admin-level capabilities — it's a standard group member
— so the old "Admin" label was misleading. Closestldraw#9014.
This builds on the capabilities abstraction from tldraw#9067: authorization
asks `can(role, capability)` and never branches on the role name, so the
rename is purely a relabel plus a data migration — no authorization
logic changes.
What changes:
- **Role definition** (`roles.ts`) — the `admin` key in the `roles`
capability table becomes `member`. `Role` is derived from these keys, so
the `group_user.role` enum in `tlaSchema.ts` and every `Role`-typed call
site update for free.
- **Sync worker** — accepting a group invite now assigns `role:
'member'`.
- **Client UI** — the members list and role dropdown show "Member" (the
dropdown is data-driven from the role → label map, so only the label and
the map key change).
- **Database** — migration `033` drops the `group_user` role check
constraint, rewrites existing `admin` rows to `member`, then re-adds the
constraint allowing `('member', 'owner')`.
Because the new check constraint rejects `'admin'`, the migration should
run as part of the deploy that ships this change. In the `deploy-dotcom`
flow migrations run before the sync worker is deployed, so existing rows
are rewritten and the constraint swapped before any new code writes
`'member'`. Groups is behind the `groups_backend` / `groups_frontend`
flags and was added recently, so little data has accumulated.
### Change type
- [x] `improvement`
### Test plan
1. Open a group's settings dialog as the owner.
2. Confirm the members list shows "Member" (not "Admin") next to
non-owner members.
3. Confirm the role dropdown offers "Owner" and "Member".
4. Change a member's role to Owner and back; confirm it persists.
5. Accept a group invite as a new user; confirm they join as a member.
- [x] Unit tests
- [ ] End to end tests
`roles.test.ts` covers the role → capability matrix and `isRole` under
the new name; `mutators.test.ts` group tests run against `member`
fixtures.
### Code changes
| Section | LOC change |
| --------------- | ---------- |
| Core code | +2 / -8 |
| Tests | +35 / -35 |
| Automated files | +9 / -9 |
| Apps | +17 / -4 |
Copy file name to clipboardExpand all lines: apps/dotcom/client/public/tla/locales/en.json
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -314,6 +314,9 @@
314
314
"815e116a2e": {
315
315
"translation": "Have a bug, issue, or idea for tldraw? Let us know! Fill out this form and we will follow up over email if needed. You can also <discord>chat with us on Discord</discord> or <github>submit an issue on GitHub</github>."
316
316
},
317
+
"858ba4765e": {
318
+
"translation": "Member"
319
+
},
317
320
"85a082de1b": {
318
321
"translation": "Please refresh the page to get the latest version of tldraw."
0 commit comments