diff --git a/surfsense_backend/app/notifications/service/handlers/comment_reply.py b/surfsense_backend/app/notifications/service/handlers/comment_reply.py index 9457125b1..7d9a9495a 100644 --- a/surfsense_backend/app/notifications/service/handlers/comment_reply.py +++ b/surfsense_backend/app/notifications/service/handlers/comment_reply.py @@ -10,6 +10,7 @@ from sqlalchemy.ext.asyncio import AsyncSession from app.notifications.persistence import Notification from app.notifications.service.base import BaseNotificationHandler +from app.notifications.service.messages.text import truncate logger = logging.getLogger(__name__) @@ -59,7 +60,7 @@ class CommentReplyNotificationHandler(BaseNotificationHandler): return existing title = f"{author_name} replied in a thread" - message = content_preview[:100] + ("..." if len(content_preview) > 100 else "") + message = truncate(content_preview, 100) metadata = { "reply_id": reply_id, diff --git a/surfsense_backend/app/notifications/service/handlers/mention.py b/surfsense_backend/app/notifications/service/handlers/mention.py index 650907bab..568dc01de 100644 --- a/surfsense_backend/app/notifications/service/handlers/mention.py +++ b/surfsense_backend/app/notifications/service/handlers/mention.py @@ -10,6 +10,7 @@ from sqlalchemy.ext.asyncio import AsyncSession from app.notifications.persistence import Notification from app.notifications.service.base import BaseNotificationHandler +from app.notifications.service.messages.text import truncate logger = logging.getLogger(__name__) @@ -58,7 +59,7 @@ class MentionNotificationHandler(BaseNotificationHandler): return existing title = f"{author_name} mentioned you" - message = content_preview[:100] + ("..." if len(content_preview) > 100 else "") + message = truncate(content_preview, 100) metadata = { "mention_id": mention_id,