Page MenuHomePhabricator

D6513.diff
No OneTemporary

D6513.diff

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

Mime Type
text/plain
Expires
Sat, Dec 21, 6:38 AM (19 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686695
Default Alt Text
D6513.diff (2 KB)

Event Timeline