Skip to content

Commit f010b97

Browse files
author
Jon Staab
committed
Fix requesting to join room
1 parent c2e8f1f commit f010b97

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

zooid/groups.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,6 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string {
290290
return "invalid: group not found"
291291
}
292292

293-
if event.Kind == nostr.KindSimpleGroupJoinRequest && g.IsMember(h, event.PubKey) {
294-
return "duplicate: already a member"
295-
}
296-
297-
if event.Kind == nostr.KindSimpleGroupLeaveRequest && !g.IsMember(h, event.PubKey) {
298-
return "duplicate: not currently a member"
299-
}
300-
301293
if slices.Contains(nip29.ModerationEventKinds, event.Kind) && !g.Config.CanManage(event.PubKey) {
302294
return "restricted: you are not authorized to manage groups"
303295
}
@@ -306,6 +298,22 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string {
306298
return "invalid: group not found"
307299
}
308300

301+
if event.Kind == nostr.KindSimpleGroupJoinRequest {
302+
if g.IsMember(h, event.PubKey) {
303+
return "duplicate: already a member"
304+
} else {
305+
return ""
306+
}
307+
}
308+
309+
if event.Kind == nostr.KindSimpleGroupLeaveRequest {
310+
if !g.IsMember(h, event.PubKey) {
311+
return "duplicate: not currently a member"
312+
} else {
313+
return ""
314+
}
315+
}
316+
309317
if HasTag(meta.Tags, "closed") && !g.HasAccess(h, event.PubKey) {
310318
return "restricted: you are not a member of that group"
311319
}

0 commit comments

Comments
 (0)