Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3505000
D6513.id21882.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D6513.id21882.diff
View Options
diff --git a/lib/shared/messages/change-settings-message-spec.js b/lib/shared/messages/change-settings-message-spec.js
--- a/lib/shared/messages/change-settings-message-spec.js
+++ b/lib/shared/messages/change-settings-message-spec.js
@@ -16,6 +16,7 @@
import { assertThreadType } from '../../types/thread-types';
import type { ThreadInfo } from '../../types/thread-types';
import type { RelativeUserInfo } from '../../types/user-types';
+import { ET, type EntityText } from '../../utils/entity-text';
import { validHexColorRegex } from '../account-utils';
import {
robotextToRawString,
@@ -28,7 +29,6 @@
type MessageSpec,
type MessageTitleParam,
type NotificationTextsParams,
- type RobotextParams,
} from './message-spec';
import { joinResult } from './utils';
@@ -122,26 +122,24 @@
return { ...messageData, id };
},
- robotext(
- messageInfo: ChangeSettingsMessageInfo,
- creator: string,
- params: RobotextParams,
- ): string {
+ robotext(messageInfo: ChangeSettingsMessageInfo): EntityText {
+ const creator = ET.user({ userInfo: messageInfo.creator });
if (
(messageInfo.field === 'name' || messageInfo.field === 'description') &&
messageInfo.value.toString() === ''
) {
- return `${creator} cleared ${params.encodedThreadEntity(
- messageInfo.threadID,
- 'the chat',
- )}'s ${messageInfo.field}`;
+ return ET`${creator} cleared ${ET.thread({
+ display: 'alwaysDisplayShortName',
+ threadID: messageInfo.threadID,
+ possessive: true,
+ })} ${messageInfo.field}`;
}
let value;
if (
messageInfo.field === 'color' &&
messageInfo.value.toString().match(validHexColorRegex)
) {
- value = `<#${messageInfo.value}|c${messageInfo.threadID}>`;
+ value = ET.color({ hex: `#${messageInfo.value}` });
} else if (messageInfo.field === 'type') {
invariant(
typeof messageInfo.value === 'number',
@@ -150,13 +148,13 @@
const newThreadType = assertThreadType(messageInfo.value);
value = threadLabel(newThreadType);
} else {
- value = messageInfo.value;
+ value = messageInfo.value.toString();
}
- return (
- `${creator} updated ` +
- `${params.encodedThreadEntity(messageInfo.threadID, 'the chat')}'s ` +
- `${messageInfo.field} to "${value}"`
- );
+ return ET`${creator} updated ${ET.thread({
+ display: 'alwaysDisplayShortName',
+ threadID: messageInfo.threadID,
+ possessive: true,
+ })} ${messageInfo.field} to "${value}"`;
},
notificationTexts(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 11:56 AM (17 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686695
Default Alt Text
D6513.id21882.diff (2 KB)
Attached To
Mode
D6513: [lib] Convert ChangeSettings robotext to use EntityText
Attached
Detach File
Event Timeline
Log In to Comment