fix(desktop): let channel members add members and bots without admin#815
Merged
Conversation
Any member of a non-DM channel can now add members and bots via the members-sidebar invite card, matching the relay's actual policy (only elevated roles like admin/owner are server-gated) and the header "Add agent" button, which was already unrestricted. - MembersSidebar.tsx: show the invite card to any member of a non-DM channel, not just owner/admin (still excludes DMs). - ChannelMemberInviteCard.tsx: hide the elevated "admin" role from the dropdown for non-admins (the relay rejects it anyway); owners/admins keep the full role list. Reset a stale "admin" selection if the user is demoted while the card is open. Remove and role-change controls stay admin-gated (unchanged). Mobile's members sheet has no add-bot flow, so nothing changes there. Adds a private non-DM mock channel (secret-projects) where the current user is a plain member and an e2e asserting the invite card is visible with the role dropdown limited to [member, guest, bot]. Co-authored-by: Brain <21994759fc7a6fa6b965551d35cfd7897d262f2495467f2d78694ddcfa6a5c7e@sprout-oss.stage.blox.sqprod.co> Signed-off-by: Wes <wesbillman@users.noreply.github.com>
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
Let any member of a non-DM channel add members and bots — not just owners/admins. This matches the relay's actual policy (only elevated roles like admin/owner are server-gated) and the header "Add agent" button, which was already unrestricted.
Why
In a private (or public) channel, a plain member opening the members sheet saw no "add members/bots" card because it was gated on
owner || admin. They could only add bots after being made an admin. The relay already permits any member to add others, so this was purely a desktop-UI gap.Changes (2 prod files, ~5 lines of logic)
MembersSidebar.tsx— the invite card now shows for any member of a non-DM channel:(canManageMembers || open)→(selfMember !== null || open), still excluding DMs.ChannelMemberInviteCard.tsx— for non-admins the role dropdown dropsadmin(leavingmember,guest,bot); the relay rejects a non-elevated inviter grantingadminanyway. Owners/admins keep the full list. Also resets a staleadminselection if the user is demoted while the card is open.Remove + role-change controls stay admin-gated (unchanged). Mobile's members sheet has no add-bot flow, so nothing changes there.
Tests
secret-projects) where the current user is a plain member.[member, guest, bot].Verification
Typecheck + biome + file-size checks green. Full desktop smoke e2e: 120 passed (incl. the new test).