From 5d3079c2e603a0511794acea29b4845cf05059ed Mon Sep 17 00:00:00 2001 From: CREDO23 Date: Wed, 17 Jun 2026 15:06:05 +0200 Subject: [PATCH] truncate document processing notification titles --- .../service/messages/document_processing.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/surfsense_backend/app/notifications/service/messages/document_processing.py b/surfsense_backend/app/notifications/service/messages/document_processing.py index 3805c2847..1f324b35d 100644 --- a/surfsense_backend/app/notifications/service/messages/document_processing.py +++ b/surfsense_backend/app/notifications/service/messages/document_processing.py @@ -6,6 +6,8 @@ import hashlib from datetime import UTC, datetime from typing import Any +from app.notifications.service.messages.text import format_title + def operation_id(document_type: str, filename: str, search_space_id: int) -> str: """Build a unique id for a document processing run.""" @@ -14,6 +16,11 @@ def operation_id(document_type: str, filename: str, search_space_id: int) -> str return f"doc_{document_type}_{search_space_id}_{timestamp}_{filename_hash}" +def started_title(document_name: str) -> str: + """Title shown when document processing is queued.""" + return format_title("Processing: ", document_name) + + def progress( stage: str, stage_message: str | None = None, @@ -44,11 +51,11 @@ def completion( ) -> tuple[str, str, str, dict[str, Any]]: """Compute the final title, message, status, and metadata for a finished run.""" if error_message: - title = f"Failed: {document_name}" + title = format_title("Failed: ", document_name) message = f"Processing failed: {error_message}" status = "failed" else: - title = f"Ready: {document_name}" + title = format_title("Ready: ", document_name) message = "Now searchable!" status = "completed"