Tweak auto join behavior
This commit is contained in:
@@ -43,7 +43,7 @@ Contains policy and access related configuration.
|
||||
Configures NIP 29 support.
|
||||
|
||||
- `enabled` - whether NIP 29 is enabled.
|
||||
- `auto_join` - whether relay members can join `open` groups without approval. Defaults to `true`.
|
||||
- `auto_join` - whether relay members can join groups without approval. Defaults to `false`.
|
||||
|
||||
### `[management]`
|
||||
|
||||
|
||||
+2
-16
@@ -373,25 +373,11 @@ func (instance *Instance) OnEvent(ctx context.Context, event nostr.Event) (rejec
|
||||
}
|
||||
|
||||
func (instance *Instance) OnEventSaved(ctx context.Context, event nostr.Event) {
|
||||
var groupMeta nostr.Event
|
||||
var groupFound bool
|
||||
|
||||
h := GetGroupIDFromEvent(event)
|
||||
|
||||
if h != "" {
|
||||
groupMeta, groupFound = instance.Groups.GetMetadata(h)
|
||||
|
||||
if !groupFound && event.Kind != nostr.KindSimpleGroupCreateGroup {
|
||||
log.Printf("Attempted to process event for nonexistent group %s", h)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if event.Kind == nostr.KindSimpleGroupJoinRequest && instance.Config.Groups.AutoJoin {
|
||||
if !HasTag(groupMeta.Tags, "closed") {
|
||||
instance.Groups.AddMember(h, event.PubKey)
|
||||
instance.Groups.UpdateMembersList(h)
|
||||
}
|
||||
instance.Groups.AddMember(h, event.PubKey)
|
||||
instance.Groups.UpdateMembersList(h)
|
||||
}
|
||||
|
||||
if event.Kind == nostr.KindSimpleGroupLeaveRequest {
|
||||
|
||||
Reference in New Issue
Block a user