Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513370
D6873.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D6873.diff
View Options
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';
@@ -182,6 +183,10 @@
badgeOnly,
unreadCount: unreadCounts[userID],
codeVersion,
+ notifTargetUserInfo: {
+ id: userID,
+ username,
+ },
});
return await sendIOSNotification(notification, [...deviceTokens], {
...notificationInfo,
@@ -208,6 +213,10 @@
badgeOnly,
unreadCount: unreadCounts[userID],
codeVersion,
+ notifTargetUserInfo: {
+ id: userID,
+ username,
+ },
dbID,
});
return await sendAndroidNotification(
@@ -515,6 +524,7 @@
+badgeOnly: boolean,
+unreadCount: number,
+codeVersion: number,
+ +notifTargetUserInfo: UserInfo,
};
async function prepareIOSNotification(
inputData: IOSNotifInputData,
@@ -527,6 +537,7 @@
badgeOnly,
unreadCount,
codeVersion,
+ notifTargetUserInfo,
} = inputData;
const uniqueID = uuidv4();
@@ -536,6 +547,7 @@
const { merged, ...rest } = await notifTextsForMessageInfo(
allMessageInfos,
threadInfo,
+ notifTargetUserInfo,
getENSNames,
);
if (!badgeOnly) {
@@ -597,6 +609,7 @@
badgeOnly,
unreadCount,
codeVersion,
+ notifTargetUserInfo,
dbID,
} = inputData;
@@ -604,6 +617,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<MessageInfo>,
threadInfo: ThreadInfo,
) => Promise<NotifTexts>,
+ +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<ResolvedNotifTexts> {
const fullNotifTexts = await fullNotifTextsForMessageInfo(
messageInfos,
threadInfo,
+ notifTargetUserInfo,
getENSNames,
);
const merged = trimText(fullNotifTexts.merged, 300);
@@ -142,6 +144,7 @@
async function fullNotifTextsForMessageInfo(
messageInfos: $ReadOnlyArray<MessageInfo>,
threadInfo: ThreadInfo,
+ notifTargetUserInfo: UserInfo,
getENSNames: ?GetENSNames,
): Promise<ResolvedNotifTexts> {
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 (
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 11:58 PM (18 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692914
Default Alt Text
D6873.diff (4 KB)
Attached To
Mode
D6873: [keyserver][lib] Pass notifTargetUserInfo to notificationTexts
Attached
Detach File
Event Timeline
Log In to Comment