Page MenuHomePhabricator

D6573.id22052.diff
No OneTemporary

D6573.id22052.diff

diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js
--- a/lib/utils/entity-text.js
+++ b/lib/utils/entity-text.js
@@ -212,6 +212,7 @@
function getNameForThreadEntity(
entity: ThreadEntity,
threadID: ?string,
+ params?: EntityTextToRawStringParams,
): string {
const { name: userGeneratedName, display } = entity;
if (entity.display === 'uiName') {
@@ -222,12 +223,16 @@
`getNameForThreadEntity can't handle thread entity display ${display}`,
);
- let name = userGeneratedName;
+ let { name } = entity;
if (!name || entity.alwaysDisplayShortName) {
const threadType = entity.threadType ?? threadTypes.PERSONAL;
- name = entity.subchannel ? 'subchannel' : threadNoun(threadType);
+ const noun = entity.subchannel ? 'subchannel' : threadNoun(threadType);
if (entity.id === threadID) {
- name = `this ${name}`;
+ const prefixThisThreadNounWith =
+ params?.prefixThisThreadNounWith === 'your' ? 'your' : 'this';
+ name = `${prefixThisThreadNounWith} ${noun}`;
+ } else {
+ name = `a ${noun}`;
}
}
if (entity.possessive) {
@@ -252,6 +257,7 @@
type EntityTextToRawStringParams = {
+threadID?: ?string,
+ignoreViewer?: ?boolean,
+ +prefixThisThreadNounWith?: ?('this' | 'your'),
};
function entityTextToRawString(
entityText: EntityText,
@@ -261,7 +267,7 @@
if (typeof entity === 'string') {
return entity;
} else if (entity.type === 'thread') {
- return getNameForThreadEntity(entity, params?.threadID);
+ return getNameForThreadEntity(entity, params?.threadID, params);
} else if (entity.type === 'color') {
return entity.hex;
} else if (entity.type === 'user') {

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 21, 12:08 PM (19 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2687223
Default Alt Text
D6573.id22052.diff (1 KB)

Event Timeline