From 04e93939f68c7b87fde9dffde72efe09122cc523 Mon Sep 17 00:00:00 2001 From: Kristina Date: Mon, 9 Sep 2024 19:14:23 +0400 Subject: [PATCH] Show full mention message in email and telegram (#6473) Signed-off-by: Kristina Fefelova --- server-plugins/notification-resources/src/index.ts | 10 +++++++++- server-plugins/telegram-resources/src/index.ts | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/server-plugins/notification-resources/src/index.ts b/server-plugins/notification-resources/src/index.ts index c672cf832a..d326a20b35 100644 --- a/server-plugins/notification-resources/src/index.ts +++ b/server-plugins/notification-resources/src/index.ts @@ -78,7 +78,7 @@ import serverNotification, { SenderInfo } from '@hcengineering/server-notification' import serverView from '@hcengineering/server-view' -import { markupToText, stripTags } from '@hcengineering/text' +import { markupToHTML, markupToText, stripTags } from '@hcengineering/text' import { encodeObjectURI } from '@hcengineering/view' import { workbenchId } from '@hcengineering/workbench' import webpush, { WebPushError } from 'web-push' @@ -234,6 +234,14 @@ export async function getContentByTemplate ( ? await getTranslatedNotificationContent(notificationData, notificationData._class, control) : {} + if ( + notificationData !== undefined && + control.hierarchy.isDerived(notificationData._class, notification.class.MentionInboxNotification) + ) { + const text = (notificationData as MentionInboxNotification).messageHtml + params.body = text !== undefined ? markupToHTML(text) : params.body + } + if (message !== undefined) { const markup = await messageToMarkup(control, message) params.message = markup !== undefined ? markupToText(markup) : params.message ?? '' diff --git a/server-plugins/telegram-resources/src/index.ts b/server-plugins/telegram-resources/src/index.ts index 7551284708..7e9af9c0db 100644 --- a/server-plugins/telegram-resources/src/index.ts +++ b/server-plugins/telegram-resources/src/index.ts @@ -30,8 +30,13 @@ import { TxProcessor } from '@hcengineering/core' import { TriggerControl } from '@hcengineering/server-core' +import notification, { + BaseNotificationType, + InboxNotification, + MentionInboxNotification, + NotificationType +} from '@hcengineering/notification' import telegram, { TelegramMessage, TelegramNotificationRequest } from '@hcengineering/telegram' -import { BaseNotificationType, InboxNotification, NotificationType } from '@hcengineering/notification' import setting, { Integration } from '@hcengineering/setting' import { NotificationProviderFunc, ReceiverInfo, SenderInfo } from '@hcengineering/server-notification' import { getMetadata, getResource, translate } from '@hcengineering/platform' @@ -196,7 +201,10 @@ async function getTranslatedData ( let { title, body } = await getTranslatedNotificationContent(data, data._class, control) let quote: string | undefined - if (data.data !== undefined) { + if (hierarchy.isDerived(data._class, notification.class.MentionInboxNotification)) { + const text = (data as MentionInboxNotification).messageHtml + body = text !== undefined ? markupToHTML(text) : body + } else if (data.data !== undefined) { body = markupToHTML(data.data) } else if (message !== undefined) { const html = await activityMessageToHtml(control, message)