diff --git a/zooid/config.go b/zooid/config.go index a7369ca..b810f6d 100644 --- a/zooid/config.go +++ b/zooid/config.go @@ -31,8 +31,8 @@ type Config struct { } `toml:"policy"` Groups struct { - Enabled bool `toml:"enabled"` - AutoJoin bool `toml:"auto_join"` + Enabled bool `toml:"enabled"` + AutoJoin bool `toml:"auto_join"` } `toml:"groups"` Management struct { diff --git a/zooid/groups.go b/zooid/groups.go index cc55248..b7af79a 100644 --- a/zooid/groups.go +++ b/zooid/groups.go @@ -283,9 +283,9 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string { meta, found := g.GetMetadata(h) if event.Kind == nostr.KindSimpleGroupCreateGroup { - if found { - return "invalid: that group already exists" - } + if found { + return "invalid: that group already exists" + } } else if !found { return "invalid: group not found" } @@ -299,19 +299,19 @@ func (g *GroupStore) CheckWrite(event nostr.Event) string { } if event.Kind == nostr.KindSimpleGroupJoinRequest { - if g.IsMember(h, event.PubKey) { - return "duplicate: already a member" - } else { - return "" - } + 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 !g.IsMember(h, event.PubKey) { + return "duplicate: not currently a member" + } else { + return "" + } } if HasTag(meta.Tags, "closed") && !g.HasAccess(h, event.PubKey) { diff --git a/zooid/management.go b/zooid/management.go index 1513862..4b6f118 100644 --- a/zooid/management.go +++ b/zooid/management.go @@ -298,6 +298,10 @@ func (m *ManagementStore) AllowPubkey(pubkey nostr.PubKey) error { // Joining func (m *ManagementStore) ValidateJoinRequest(event nostr.Event) (reject bool, err string) { + if m.IsMember(event.PubKey) { + return false, "" + } + if m.PubkeyIsBanned(event.PubKey) { return true, "invalid: you have been banned from this relay" }