Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2846819
D6580.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D6580.diff
View Options
diff --git a/lib/shared/messages/join-thread-message-spec.js b/lib/shared/messages/join-thread-message-spec.js
--- a/lib/shared/messages/join-thread-message-spec.js
+++ b/lib/shared/messages/join-thread-message-spec.js
@@ -15,11 +15,13 @@
import type { NotifTexts } from '../../types/notif-types';
import type { ThreadInfo } from '../../types/thread-types';
import type { RelativeUserInfo } from '../../types/user-types';
-import { ET, type EntityText } from '../../utils/entity-text';
+import {
+ ET,
+ type EntityText,
+ pluralizeEntityText,
+} from '../../utils/entity-text';
import { values } from '../../utils/objects';
-import { pluralize } from '../../utils/text-utils';
-import { stringForUser } from '../user-utils';
-import type { MessageSpec, NotificationTextsParams } from './message-spec';
+import type { MessageSpec } from './message-spec';
import { joinResult } from './utils';
export const joinThreadMessageSpec: MessageSpec<
@@ -82,7 +84,6 @@
async notificationTexts(
messageInfos: $ReadOnlyArray<MessageInfo>,
threadInfo: ThreadInfo,
- params: NotificationTextsParams,
): Promise<NotifTexts> {
const joinerArray = {};
for (const messageInfo of messageInfos) {
@@ -93,10 +94,14 @@
joinerArray[messageInfo.creator.id] = messageInfo.creator;
}
const joiners = values(joinerArray);
- const joinersString = pluralize(joiners.map(stringForUser));
+ const joiningUsers = pluralizeEntityText(
+ joiners.map(user => ET`${ET.user({ userInfo: user })}`),
+ );
+
+ const body = ET`${joiningUsers} joined`;
+ const thread = ET.thread({ display: 'shortName', threadInfo });
+ const merged = ET`${body} ${thread}`;
- const body = `${joinersString} joined`;
- const merged = `${body} ${params.notifThreadName(threadInfo)}`;
return {
merged,
title: threadInfo.uiName,
diff --git a/lib/shared/messages/leave-thread-message-spec.js b/lib/shared/messages/leave-thread-message-spec.js
--- a/lib/shared/messages/leave-thread-message-spec.js
+++ b/lib/shared/messages/leave-thread-message-spec.js
@@ -15,11 +15,13 @@
import type { NotifTexts } from '../../types/notif-types';
import type { ThreadInfo } from '../../types/thread-types';
import type { RelativeUserInfo } from '../../types/user-types';
-import { ET, type EntityText } from '../../utils/entity-text';
+import {
+ ET,
+ type EntityText,
+ pluralizeEntityText,
+} from '../../utils/entity-text';
import { values } from '../../utils/objects';
-import { pluralize } from '../../utils/text-utils';
-import { stringForUser } from '../user-utils';
-import type { MessageSpec, NotificationTextsParams } from './message-spec';
+import type { MessageSpec } from './message-spec';
import { joinResult } from './utils';
export const leaveThreadMessageSpec: MessageSpec<
@@ -82,7 +84,6 @@
async notificationTexts(
messageInfos: $ReadOnlyArray<MessageInfo>,
threadInfo: ThreadInfo,
- params: NotificationTextsParams,
): Promise<NotifTexts> {
const leaverBeavers = {};
for (const messageInfo of messageInfos) {
@@ -93,10 +94,14 @@
leaverBeavers[messageInfo.creator.id] = messageInfo.creator;
}
const leavers = values(leaverBeavers);
- const leaversString = pluralize(leavers.map(stringForUser));
+ const leavingUsers = pluralizeEntityText(
+ leavers.map(user => ET`${ET.user({ userInfo: user })}`),
+ );
+
+ const body = ET`${leavingUsers} left`;
+ const thread = ET.thread({ display: 'shortName', threadInfo });
+ const merged = ET`${body} ${thread}`;
- const body = `${leaversString} left`;
- const merged = `${body} ${params.notifThreadName(threadInfo)}`;
return {
merged,
title: threadInfo.uiName,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 1, 12:23 AM (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2208484
Default Alt Text
D6580.diff (3 KB)
Attached To
Mode
D6580: [lib] Migrate JoinThread/LeaveThread notifTexts to use EntityText
Attached
Detach File
Event Timeline
Log In to Comment