Merge remote-tracking branch 'origin/dev'

# Conflicts:
#	routes/document_routes.py
This commit is contained in:
pewdiepie-archdaemon
2026-07-01 10:11:22 +00:00
44 changed files with 3498 additions and 856 deletions
+11 -3
View File
@@ -6,7 +6,7 @@ Reusable document actions callable from both REST routes and the task scheduler.
import logging
import re
from datetime import datetime
from datetime import datetime, timezone
logger = logging.getLogger(__name__)
@@ -77,12 +77,20 @@ async def run_document_tidy(owner: str) -> str:
deleted = 0
kept = 0
survivors = [] # docs that pass the junk rules, considered for dedup
now = datetime.utcnow()
now = datetime.now(timezone.utc)
for doc in docs:
created = doc.created_at
if created and created.tzinfo is None:
created = created.replace(tzinfo=timezone.utc)
# Skip freshly created documents to avoid deleting them while the user is actively editing
if created and (now - created).total_seconds() < 900: # 15 minutes
survivors.append(doc)
continue
content = (doc.current_content or "").strip()
title = (doc.title or "").strip().lower()
created = doc.created_at
is_fresh_empty = (
not content
and created is not None