Since block#9592 the relay refuses a kind:9001 removal of an owner unless the
actor is an owner too (classify_remove_other), including when the owner
is the actor's own agent. The members sidebar still offered Remove on an
owner to every admin, and to a member whose own agent had become an
owner, so the removal was sent and rejected.
Move the sidebar's removal predicate into canRemoveChannelMember, next
to the add rule, and deny an owner target to anyone who is not an
owner. Every other case keeps its current answer.
Signed-off-by: Shani Singh <teamdeveloperworld@gmail.com>
Summary
Since #9592, the relay lets only an owner remove another owner. That holds even when the owner being removed is the remover's own agent. The rule is
classify_remove_otherincrates/buzz-relay/src/handlers/channel_authz.rs, and the DB enforces it again under the lock ("only owners may remove another owner").The 0.X desktop's members sidebar decides whether to show Remove with its own inline check, which wasn't updated. It showed Remove on an owner to:
The kind:9001 was sent and then rejected. The bulk removal of managed bots (
removableManagedBots) uses the same check.Change
The sidebar's inline check moves into a small pure function,
canRemoveChannelMember, indesktop/src/features/channels/lib/channelMemberRemoval.ts, next to the existing add rule. It also hides Remove on an owner from anyone who isn't an owner.Every other case gives the same answer as before:
One gap remains on purpose: the relay also lets an owner remove another owner, but the desktop already didn't offer that. Keeping it hidden is the conservative direction, so it's left alone.
Related issue
None found. I searched PRs and issues for "remove owner admin desktop", "canRemoveMember", "admin remove owner", "owner precedence desktop" and "classify_remove_other".
Heads-up: open #5774 ("let a declared owner remove their own stale agent seat") rewrites the same check into
memberUtils.tsfor a different defect. Its test still expects an admin to be able to remove an owner, which the relay now refuses, so the two will need reconciling.Testing
New
channelMemberRemoval.test.mjs:anyone may remove themselvesadmins and owners remove members, members only their own agentsonly an owner removes an owner, as the relay's classify_remove_other requiresOn
main: the function doesn't exist there yet. So I first movedmain's exact predicate into it unchanged, and the owner-precedence test failed: "an admin must not be offered removing an owner",true !== false. The other two tests passed.With this change: all 3 pass.
pnpm typecheck, biome on the changed files, andnode scripts/check-file-sizes.mjsare clean.Manual check