diff --git a/lib/shared/messages/create-sidebar-message-spec.js b/lib/shared/messages/create-sidebar-message-spec.js --- a/lib/shared/messages/create-sidebar-message-spec.js +++ b/lib/shared/messages/create-sidebar-message-spec.js @@ -6,6 +6,7 @@ pushTypes, type CreateMessageInfoParams, type MessageSpec, + type NotificationTextsParams, } from './message-spec.js'; import { joinResult } from './utils.js'; import type { PlatformDetails } from '../../types/device-types.js'; @@ -28,6 +29,7 @@ type EntityText, pluralizeEntityText, } from '../../utils/entity-text.js'; +import { isMentioned } from '../mention-utils.js'; import { hasMinCodeVersion } from '../version-utils.js'; export const createSidebarMessageSpec: MessageSpec< @@ -178,6 +180,7 @@ async notificationTexts( messageInfos: $ReadOnlyArray, threadInfo: ThreadInfo, + params: NotificationTextsParams, ): Promise { const firstMessageInfo = messageInfos[0]; invariant( @@ -196,7 +199,19 @@ let body = `started a thread in response to `; body = ET`${body} ${sourceMessageAuthorPossessive} message`; - if (initialName) { + + const { username } = params.notifTargetUserInfo; + + const secondMessageInfo = messageInfos[1]; + if ( + username && + secondMessageInfo && + secondMessageInfo.type === messageTypes.SIDEBAR_SOURCE && + secondMessageInfo.sourceMessage.type === messageTypes.TEXT && + isMentioned(username, secondMessageInfo.sourceMessage.text) + ) { + body = ET`${body} that tagged you`; + } else if (initialName) { body = ET`${body} "${initialName}"`; }