Skip to content

feat: add change member role in channel sidebar#313

Open
rbrackney-sq wants to merge 5 commits intomainfrom
feat/change-member-role
Open

feat: add change member role in channel sidebar#313
rbrackney-sq wants to merge 5 commits intomainfrom
feat/change-member-role

Conversation

@rbrackney-sq
Copy link
Copy Markdown
Collaborator

Summary

  • Added "Change role" submenu to member actions dropdown in the members sidebar
  • Owners and admins can change any other human member's role (admin, member, guest)
  • Bots cannot have their role changed (bot is an actor type, not a permission tier)
  • Owner assignment is blocked (requires a dedicated transfer-ownership flow)
  • Reuses the existing kind:9000 add-member upsert path — no relay or DB changes needed

Known limitations

  • System message: Role changes emit a "member added" system message since we reuse kind:9000. A dedicated member_role_changed system message type in the relay's side effects handler would fix this.
  • Last-owner safety: The relay's add-member upsert path does not guard against demoting the last owner (the remove path does). This is a pre-existing gap — our Tauri command blocks owner assignment, but a crafted client could still demote an owner via a raw event.

Test plan

  • Change a member from "member" to "admin" — verify role persists after page reload
  • Verify bots do not show the "Change role" menu
  • Verify owners do not show the "Change role" menu
  • Verify non-owner/admin users do not see "Change role" on other members
  • Attempt to change your own role — should not be available
  • Verify error message surfaces if role change fails

🤖 Generated with Claude Code

rbrackney-sq and others added 3 commits April 13, 2026 16:26
The members sidebar only supported adding members with a role at invite time
and removing them. There was no way to change an existing member's role without
removing and re-adding them.

Added a "Change role" submenu to the member actions dropdown that lets
owners/admins change any other member's role (admin, member, guest, bot).
The feature reuses the existing add_member upsert path which already handles
role updates, so no database or relay changes were needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Addresses code review feedback:
- Separate assignable roles by member type: people get admin/member/guest,
  bots get bot/guest. Prevents nonsensical people↔bot transitions.
- Block owner assignment via the change role command (requires dedicated
  transfer-ownership flow).
- Surface mutation pending state to disable the menu during role changes.
- Display role change errors in the sidebar error area.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Bots should always be "bot" — changing a bot to guest makes it read-only
and unable to respond, which is a broken agent. Role changes are now only
available for human members (admin/member/guest).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
rbrackney-sq and others added 2 commits April 13, 2026 19:55
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
hooks.ts was 554 lines (limit 550). Moved the changeChannelMemberRole
mutation inline into MembersSidebar.tsx where it's the only consumer.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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