fixed post token invalidation via mail/telegramm

This commit is contained in:
2026-02-20 15:24:17 +01:00
parent 10b07d89ac
commit c956562722
3 changed files with 61 additions and 6 deletions

View File

@@ -2328,13 +2328,12 @@ async def update_post_status(
chat_id=telegram_account.telegram_chat_id,
text=(
f"📋 <b>{company_name}</b> hat deinen Post bearbeitet und bittet um deine Freigabe:\n\n"
f"<i>{post.topic_title or 'Untitled Post'}</i>\n\n"
f"Bitte gib den Post frei oder lehne ihn ab:"
f"<i>{post.topic_title or 'Untitled Post'}</i>"
),
reply_markup={
"inline_keyboard": [[
{"text": "✅ Freigeben", "url": approve_url},
{"text": "❌ Ablehnen", "url": reject_url}
{"text": "✅ Freigeben", "callback_data": f"approve:{approve_token}"},
{"text": "❌ Ablehnen", "callback_data": f"reject:{reject_token}"}
]]
}
)
@@ -2453,8 +2452,8 @@ async def handle_email_action(request: Request, token: str):
# Update post status
await db.update_generated_post(post_id, {"status": new_status})
# Mark token as used
await mark_token_used(token)
# Invalidate ALL tokens for this post (both approve + reject)
await db.mark_all_post_tokens_used(post_id)
# Send notification to creator
if profile and profile.creator_email: