Changeset View
Changeset View
Standalone View
Standalone View
lib/utils/entity-text.js
Show First 20 Lines • Show All 247 Lines • ▼ Show 20 Lines | ): string { | ||||
invariant( | invariant( | ||||
entity.display === 'shortName', | entity.display === 'shortName', | ||||
`getNameForThreadEntity can't handle thread entity display ${display}`, | `getNameForThreadEntity can't handle thread entity display ${display}`, | ||||
); | ); | ||||
let { name } = entity; | let { name } = entity; | ||||
if (!name || entity.alwaysDisplayShortName) { | if (!name || entity.alwaysDisplayShortName) { | ||||
const threadType = entity.threadType ?? threadTypes.PERSONAL; | const threadType = entity.threadType ?? threadTypes.PERSONAL; | ||||
const noun = entity.subchannel ? 'subchannel' : threadNoun(threadType); | const { parentThreadID } = entity; | ||||
const noun = entity.subchannel | |||||
? 'subchannel' | |||||
: threadNoun(threadType, parentThreadID); | |||||
if (entity.id === params?.threadID) { | if (entity.id === params?.threadID) { | ||||
const prefixThisThreadNounWith = | const prefixThisThreadNounWith = | ||||
params?.prefixThisThreadNounWith === 'your' ? 'your' : 'this'; | params?.prefixThisThreadNounWith === 'your' ? 'your' : 'this'; | ||||
name = `${prefixThisThreadNounWith} ${noun}`; | name = `${prefixThisThreadNounWith} ${noun}`; | ||||
} else { | } else { | ||||
name = `a ${noun}`; | name = `a ${noun}`; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 262 Lines • Show Last 20 Lines |