Fix requesting to join room
This commit is contained in:
+16
-8
@@ -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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user