Skip to content

Mark a role as invite-grantable, and bind one to an invite (GRYT-893) - #371

Merged
sivert-io merged 1 commit into
mainfrom
claude/GRYT-893-invite-role-ui
Sep 3, 2026
Merged

Mark a role as invite-grantable, and bind one to an invite (GRYT-893)#371
sivert-io merged 1 commit into
mainfrom
claude/GRYT-893-invite-role-ui

Conversation

@sivert-io

@sivert-io sivert-io commented Sep 3, 2026

Copy link
Copy Markdown
Member

The client half of the invite role binding. Gryt-chat/server#129 has the rules and the storage; without this nothing can set the flag or bind a role, so that PR ships inert.

Merge the server one first — this talks to grantableByInvite on server:roles:definitions and sends grantsRole on server:invites:create, neither of which exists until it lands. Against an older server the tick saves nothing and the picker never appears, which is ugly but not broken.

Two pieces

The role editor gets a tick, "Can be given out by an invite", off for every role until somebody turns it on and disabled for built-in roles. The copy under it says the two things somebody needs before ticking: the role is then only as private as the link, and admin, owner and anything able to hand out permissions can never be given this way whatever the tick says.

The invite form gets a role picker, which only appears once at least one role has been marked. An empty picker on a server where nobody has ticked anything reads as the feature being broken; no picker reads as nothing to pick.

What to look at

The picker lists what the server sent back, already filtered, rather than filtering here. The server also refuses any role sitting at or above your own in the list, and duplicating that rule in the client is how the two drift apart — but it does mean the list can contain a role the server will then refuse, and the refusal arrives as a server:error toast rather than the option being absent. I think that is the right trade; say if you would rather it were filtered both ends.

Verification

yarn lint clean — tsc -b plus eslint at zero warnings. Not exercised against a running server, because the server half is not merged yet, so the wire format is checked by reading rather than by joining.

Caught one of my own errors on the way: two edits both added grantableByInvite to the same object literal, which tsc refused. Worth mentioning only because it is the kind of thing that survives a read-through.

🤖 Generated with Claude Code

The client half of the invite role binding. server#129 has the rules and the
storage; without this nothing can set the flag or bind a role, so the feature
ships inert.

Two pieces.

The role editor gets a tick: "Can be given out by an invite", off for every role
until somebody turns it on, and disabled for built-in roles. The copy under it
says the two things somebody needs before ticking it — that the role is then
only as private as the link, and that admin, owner and anything able to hand out
permissions can never be given this way whatever the tick says.

The invite form gets a role picker, and it only appears when at least one role
has been marked. An empty picker on a server where nobody has ticked anything
would read as the feature being broken; no picker reads as nothing to pick. The
list is whatever the server sent back already filtered, rather than a judgement
made here — the server refuses roles at or above the creator's own rank too, and
duplicating that rule in the client is how the two drift apart.

`yarn lint` clean, which is `tsc -b` and eslint at zero warnings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sivert-io
sivert-io merged commit 22b1940 into main Sep 3, 2026
3 checks passed
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.

1 participant