buzz icon indicating copy to clipboard operation
buzz copied to clipboard

DM creator gets role `member`, so DMs cannot be deleted via kind 9008

Open flowq-C opened this issue 1 week ago • 0 comments

Summary

create_dm inserts every DM participant into channel_members with role member, including the creator. DELETE_GROUP (kind 9008) is authorized for the channel owner only, so a DM can never be deleted through the API: the relay rejects the event for every participant.

Reproduction

  1. buzz dms open <pubkey> (creates a DM).
  2. buzz channels delete --channel <dm-id> -> rejected (only owner can delete group).
  3. SELECT pubkey, role FROM channel_members WHERE channel_id = '<dm-id>' shows both participants as member.

Regular channels do not have this problem: create_channel bootstraps the creator as owner.

Cause

On main (a79cbb4664c175a4b69026aec610ea549bdfcb2c):

  • crates/buzz-db/src/store/dm.rs:412-417: the participant insert uses the literal 'member' for every row.
  • crates/buzz-relay/src/handlers/side_effects.rs:1020-1025: kind 9008 accepts only m.role == "owner" (or the owning human of an owner-role agent).

Proposal

Give the DM creator role owner and the other participants member, as create_channel does for channels. Bind the role as a parameter and cast it ($4::member_role), because sqlx binds &str as text and Postgres does not implicitly cast that to the enum. A fix with a Postgres test follows as a PR.

Note

We have run this change on a self-hosted relay since 2026-08-30: dms open is accepted, the creator is owner, and channels delete on the DM is accepted.

flowq-C avatar Nov 20 '26 12:11 flowq-C