From 00d61b02bd25d3851741734164d1e5deb6021c76 Mon Sep 17 00:00:00 2001 From: Acho Arnold Ewin Date: Tue, 6 Oct 2026 23:34:09 +0300 Subject: [PATCH 1/2] fix(web): support nested WhatsApp formatting and format thread previews Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3362f283-a915-49b9-ae89-d16e3c7ecb2a --- web/app/components/MessageThread.vue | 23 ++++++++++++++++++++++- web/app/utils/whatsapp-format.ts | 4 +++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/web/app/components/MessageThread.vue b/web/app/components/MessageThread.vue index 93c77324d..53bd401b0 100644 --- a/web/app/components/MessageThread.vue +++ b/web/app/components/MessageThread.vue @@ -8,6 +8,10 @@ import { mdiAccount, } from '@mdi/js' import type { EntitiesMessageThread } from '~~/shared/types/api' +import { + isUrlNotificationToken, + formatWhatsappText, +} from '~/utils/whatsapp-format' const threadsStore = useThreadsStore() const phonesStore = usePhonesStore() @@ -45,6 +49,19 @@ function onInstallApp() { }) } +function isWhatsappFormatted(thread: EntitiesMessageThread): boolean { + const phone = phonesStore.phones.find((x) => x.phone_number === thread.owner) + return isUrlNotificationToken(phone?.fcm_token) +} + +function threadPreviewHtml(thread: EntitiesMessageThread): string { + // Links are unwrapped because the preview sits inside a router link. + return formatWhatsappText(thread.last_message_content ?? '').replace( + /]*>(.*?)<\/a>/g, + '$1', + ) +} + function threadContactName(thread: EntitiesMessageThread): string { return thread.contact_details?.name?.trim() ?? '' } @@ -160,7 +177,11 @@ function threadAvatarInitial(thread: EntitiesMessageThread): string { }" style="max-width: 250px" > - {{ thread.last_message_content }} + +