diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js --- a/keyserver/src/push/send.js +++ b/keyserver/src/push/send.js @@ -30,6 +30,7 @@ } from 'lib/types/message-types.js'; import type { ServerThreadInfo, ThreadInfo } from 'lib/types/thread-types.js'; import { updateTypes } from 'lib/types/update-types.js'; +import type { UserInfo } from 'lib/types/user-types.js'; import { promiseAll } from 'lib/utils/promises.js'; import { getAPNsNotificationTopic } from './providers.js'; @@ -181,6 +182,10 @@ badgeOnly, unreadCount: unreadCounts[userID], codeVersion, + notifTargetUserInfo: { + id: userID, + username, + }, }); return await sendIOSNotification(notification, [...deviceTokens], { ...notificationInfo, @@ -207,6 +212,10 @@ badgeOnly, unreadCount: unreadCounts[userID], codeVersion, + notifTargetUserInfo: { + id: userID, + username, + }, dbID, }); return await sendAndroidNotification( @@ -489,6 +498,7 @@ +badgeOnly: boolean, +unreadCount: number, +codeVersion: number, + +notifTargetUserInfo: UserInfo, }; async function prepareIOSNotification( inputData: IOSNotifInputData, @@ -501,6 +511,7 @@ badgeOnly, unreadCount, codeVersion, + notifTargetUserInfo, } = inputData; const uniqueID = uuidv4(); @@ -510,6 +521,7 @@ const { merged, ...rest } = await notifTextsForMessageInfo( allMessageInfos, threadInfo, + notifTargetUserInfo, getENSNames, ); if (!badgeOnly) { @@ -571,6 +583,7 @@ badgeOnly, unreadCount, codeVersion, + notifTargetUserInfo, dbID, } = inputData; @@ -578,6 +591,7 @@ const { merged, ...rest } = await notifTextsForMessageInfo( allMessageInfos, threadInfo, + notifTargetUserInfo, getENSNames, ); const notification = { diff --git a/lib/shared/messages/message-spec.js b/lib/shared/messages/message-spec.js --- a/lib/shared/messages/message-spec.js +++ b/lib/shared/messages/message-spec.js @@ -12,7 +12,7 @@ import type { RawUnsupportedMessageInfo } from '../../types/messages/unsupported.js'; import type { NotifTexts } from '../../types/notif-types.js'; import type { ThreadInfo } from '../../types/thread-types.js'; -import type { RelativeUserInfo } from '../../types/user-types.js'; +import type { RelativeUserInfo, UserInfo } from '../../types/user-types.js'; import type { EntityText } from '../../utils/entity-text.js'; import { type ParserRules } from '../markdown.js'; @@ -48,6 +48,7 @@ messageInfos: $ReadOnlyArray, threadInfo: ThreadInfo, ) => Promise, + +notifTargetUserInfo: UserInfo, }; export type GeneratesNotifsParams = { diff --git a/lib/shared/notif-utils.js b/lib/shared/notif-utils.js --- a/lib/shared/notif-utils.js +++ b/lib/shared/notif-utils.js @@ -14,7 +14,7 @@ } from '../types/message-types.js'; import type { NotifTexts, ResolvedNotifTexts } from '../types/notif-types.js'; import type { ThreadInfo, ThreadType } from '../types/thread-types.js'; -import type { RelativeUserInfo } from '../types/user-types.js'; +import type { RelativeUserInfo, UserInfo } from '../types/user-types.js'; import { prettyDate } from '../utils/date-utils.js'; import type { GetENSNames } from '../utils/ens-helpers.js'; import { @@ -29,11 +29,13 @@ async function notifTextsForMessageInfo( messageInfos: MessageInfo[], threadInfo: ThreadInfo, + notifTargetUserInfo: UserInfo, getENSNames: ?GetENSNames, ): Promise { const fullNotifTexts = await fullNotifTextsForMessageInfo( messageInfos, threadInfo, + notifTargetUserInfo, getENSNames, ); const merged = trimText(fullNotifTexts.merged, 300); @@ -142,6 +144,7 @@ async function fullNotifTextsForMessageInfo( messageInfos: $ReadOnlyArray, threadInfo: ThreadInfo, + notifTargetUserInfo: UserInfo, getENSNames: ?GetENSNames, ): Promise { const mostRecentType = mostRecentMessageInfoType(messageInfos); @@ -157,12 +160,13 @@ fullNotifTextsForMessageInfo( innerMessageInfos, innerThreadInfo, + notifTargetUserInfo, getENSNames, ); const unresolvedNotifTexts = await messageSpec.notificationTexts( messageInfos, threadInfo, - { notificationTexts: innerNotificationTexts }, + { notifTargetUserInfo, notificationTexts: innerNotificationTexts }, ); const resolveToString = async (