Admins can't assign roles

(#469) Bug Fixed moderation

Summary

I created a community and the other users I've made an admin cannot assign roles. They can do everything else, but roles are unselectable for them

Steps to reproduce

  1. Assign a role that has been set as "Administrator"
  2. Right-Click user and expand "Roles" sub-menu on the admin assigned user
  3. All roles in the sub-menu are unselectable

Environment (optional)

  • Version 0.0.8 Installed through Flatpak
  • EndeavourOS/KDE Plasma 6.6.3/Wayland
stable build 190 (44b69925)
Desktop stable 0.0.0
Deployed 5d
Electron 40.0.0
Linux 6.19.10-arch1-1 (x64)

Logs or screenshots (optional)

image image image
  • 572236544-663b7230-01ca-47a3-b481-6ff36b538be8.png

    572236544-663b7230-01ca-47a3-b481-6ff36b538be8.png

    857×921 | 94 kB

  • 572236648-7c2ed28f-763a-42ca-ab69-9ea047438911.png

    572236648-7c2ed28f-763a-42ca-ab69-9ea047438911.png

    451×613 | 48 kB

  • 572236390-d26979b6-b05b-46a7-8230-de24e6a6abc1.png

    572236390-d26979b6-b05b-46a7-8230-de24e6a6abc1.png

    437×584 | 43 kB

4 comments

Sign in with Fluxer to comment and vote.
Comment by @Juliaxe
RexSystem 1 vote originally by @Juliaxe on GitHub
Do your admins also happen to be unable to edit the said roles in Server Settings? If so, this bug has been reported before although in different form. But the root cause is the same.
Comment by @LionUCS
RexSystem 1 vote originally by @LionUCS on GitHub OP
Just confirmed, they can edit the roles (except the admin role)
Comment by @cproudlock
RexSystem 1 vote originally by @cproudlock on GitHub
Root cause: Two-part bug across frontend and gateway:
  1. Gateway (guild_members.erl::check_can_manage_roles): uses strict > comparison on role positions. When all non-everyone roles are at the same position (a common config), no admin can assign any role because their max position is never strictly greater than the target.
  1. Frontend (PermissionUtils.tsx::isRoleHigher): uses an indexOf on a sorted role list. When positions tie, sort order is unstable and the comparison is unreliable. The frontend disables the role menu before any request is sent.
The gateway already has correct equal-position tiebreaker logic in can_manage_role (singular) - it just wasn't applied to can_manage_roles (plural). Fix:
  • Gateway: add equal-position tiebreaker (lower role ID can manage equal-position role) to match the singular version
  • Frontend: replace indexOf comparison with direct position comparison + role ID tiebreaker
Verified working on a self-hosted instance.
Comment by @cproudlock
RexSystem 1 vote originally by @cproudlock on GitHub
Frontend fix in cproudlock/fluxer@cf1fe4bf - the gateway commit cproudlock/fluxer@1a0dc33 alone is not sufficient because the frontend disables the role menu before any request is sent.