Show full mention message in email and telegram (#6473)

Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
Kristina 2024-09-09 19:14:23 +04:00 committed by GitHub
parent fe8bf16e77
commit 04e93939f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 3 deletions

View File

@ -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 ?? ''

View File

@ -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)