-
Notifications
You must be signed in to change notification settings - Fork 8
fix: group visibility toggle fails with NDKPublishError #202
Description
Problem
Toggling a group between public and members-only via the kebab menu fails with:
NDKPublishError: Not enough relays received the event
at async publishWithAuthRetry (nip29.ts:655:3)
at async editGroupMetadata (nip29.ts:843:2)
at async handleToggleVisibility (GroupList.svelte:242:61)
The Pantry relay (wss://pantry.zap.cooking) rejects the kind 9002 edit-metadata event when visibility tags are included.
Root Cause
In src/lib/nip29.ts:832-838, editGroupMetadata sends visibility tags that may not match what the Pantry relay expects:
if (fields.visibility === 'public') {
event.tags.push(['public']);
event.tags.push(['unrestricted']);
} else if (fields.visibility === 'members-only') {
event.tags.push(['private']);
event.tags.push(['restricted']);
}Per NIP-29, kind 9002 (edit-metadata) lists unrestricted, open, visible, public as valid optional tags. The private and restricted tags are used in the kind 39000 metadata event (relay-generated), not in the user-sent edit event.
The relay likely rejects ['private'] and ['restricted'] as unrecognized tags on a kind 9002 event.
Suggested Fix
-
Confirm with the Pantry relay operator what tags kind 9002 actually accepts for toggling visibility. The NIP-29 spec is ambiguous about how to remove public/unrestricted status — it only lists the positive-form tags.
-
If the relay supports toggling via presence/absence of positive tags, update
editGroupMetadatato:- For "make public": include
['public']and['unrestricted']tags - For "make members-only": do NOT include
['private']/['restricted']— instead, the relay may expect an edit-metadata event without thepublic/unrestrictedtags to implicitly remove them
- For "make public": include
-
If the relay needs a separate mechanism, it may require a different approach entirely (e.g., a dedicated moderation event kind).
-
Add user-facing error feedback — currently the error is silently caught in
GroupList.svelte:255-256. Consider showing a toast or inline error when the toggle fails.
Files
src/lib/nip29.ts:814-846—editGroupMetadatafunctionsrc/lib/components/groups/GroupList.svelte:235-259—handleToggleVisibilityfunction