feat: event proposal and approval workflow #9

Closed
padreug wants to merge 38 commits from feat/event-approval-workflow into main
Showing only changes of commit b4d7653988 - Show all commits

fix: check auto_approve setting in propose endpoint
Some checks failed
lint.yml / fix: check auto_approve setting in propose endpoint (pull_request) Failing after 0s

The propose endpoint always set status to 'proposed' regardless of
the auto_approve setting. Now checks the setting and auto-approves
(+ publishes to Nostr) when enabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Padreug 2026-04-27 18:16:43 +02:00

View file

@ -209,10 +209,17 @@ async def api_event_propose(
""" """
Propose a new event for admin approval. Propose a new event for admin approval.
Requires invoice key (any authenticated user, not admin-only). Requires invoice key (any authenticated user, not admin-only).
Auto-approved if the admin has enabled auto_approve in settings.
""" """
data.status = "proposed" ext_settings = await get_settings()
data.status = "approved" if ext_settings.auto_approve else "proposed"
data.wallet = wallet.wallet.id data.wallet = wallet.wallet.id
event = await create_event(data) event = await create_event(data)
# Publish to Nostr if auto-approved
if event.status == "approved":
await _publish_or_delete_nostr_event(event)
return event.dict() return event.dict()