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

@@ -1613,6 +1613,12 @@ class DatabaseClient:
lambda: self.client.table("email_action_tokens").update({"used": True}).eq("token", token).execute()
)
async def mark_all_post_tokens_used(self, post_id: UUID) -> None:
"""Mark all email action tokens for a post as used (invalidate approve + reject together)."""
await asyncio.to_thread(
lambda: self.client.table("email_action_tokens").update({"used": True}).eq("post_id", str(post_id)).execute()
)
async def cleanup_expired_email_tokens(self) -> None:
"""Delete expired email tokens from the database."""
now = datetime.now(timezone.utc).isoformat()