Fix requesting to join room

This commit is contained in:
Jon Staab
2025-10-31 12:08:25 -07:00
parent c2e8f1f9fa
commit f010b97fef
+16 -8
View File
@@ -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"
}