Tweak auto join behavior

This commit is contained in:
Jon Staab
2025-10-31 12:02:50 -07:00
parent 7497dacf8d
commit c2e8f1f9fa
2 changed files with 3 additions and 17 deletions
+1 -1
View File
@@ -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
View File
@@ -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 {