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>
This commit is contained in:
Padreug 2026-04-27 18:16:43 +02:00
commit b4d7653988

View file

@ -209,10 +209,17 @@ async def api_event_propose(
"""
Propose a new event for admin approval.
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
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()