From f010b97fef53e8e330f3ba390f6b0bd4a58db2d7 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Fri, 31 Oct 2025 12:08:25 -0700 Subject: [PATCH] Fix requesting to join room --- zooid/groups.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/zooid/groups.go b/zooid/groups.go index 1a0ae9e..cc55248 100644 --- a/zooid/groups.go +++ b/zooid/groups.go @@ -290,14 +290,6 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string { return "invalid: group not found" } - if event.Kind == nostr.KindSimpleGroupJoinRequest && g.IsMember(h, event.PubKey) { - return "duplicate: already a member" - } - - if event.Kind == nostr.KindSimpleGroupLeaveRequest && !g.IsMember(h, event.PubKey) { - return "duplicate: not currently a member" - } - if slices.Contains(nip29.ModerationEventKinds, event.Kind) && !g.Config.CanManage(event.PubKey) { return "restricted: you are not authorized to manage groups" } @@ -306,6 +298,22 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string { return "invalid: group not found" } + if event.Kind == nostr.KindSimpleGroupJoinRequest { + if g.IsMember(h, event.PubKey) { + return "duplicate: already a member" + } else { + return "" + } + } + + if event.Kind == nostr.KindSimpleGroupLeaveRequest { + if !g.IsMember(h, event.PubKey) { + return "duplicate: not currently a member" + } else { + return "" + } + } + if HasTag(meta.Tags, "closed") && !g.HasAccess(h, event.PubKey) { return "restricted: you are not a member of that group" }