Changeset View
Changeset View
Standalone View
Standalone View
lib/shared/notif-utils.js
Show All 13 Lines | import { | ||||
type MessageType, | type MessageType, | ||||
type MessageData, | type MessageData, | ||||
type SidebarSourceMessageInfo, | type SidebarSourceMessageInfo, | ||||
messageTypes, | messageTypes, | ||||
} from '../types/message-types.js'; | } from '../types/message-types.js'; | ||||
import type { CreateSidebarMessageInfo } from '../types/messages/create-sidebar.js'; | import type { CreateSidebarMessageInfo } from '../types/messages/create-sidebar.js'; | ||||
import type { TextMessageInfo } from '../types/messages/text.js'; | import type { TextMessageInfo } from '../types/messages/text.js'; | ||||
import type { NotifTexts, ResolvedNotifTexts } from '../types/notif-types.js'; | import type { NotifTexts, ResolvedNotifTexts } from '../types/notif-types.js'; | ||||
import type { ThreadInfo, ThreadType } from '../types/thread-types.js'; | import { | ||||
type ThreadInfo, | |||||
type ThreadType, | |||||
threadTypes, | |||||
} from '../types/thread-types.js'; | |||||
import type { RelativeUserInfo, UserInfo } from '../types/user-types.js'; | import type { RelativeUserInfo, UserInfo } from '../types/user-types.js'; | ||||
import { prettyDate } from '../utils/date-utils.js'; | import { prettyDate } from '../utils/date-utils.js'; | ||||
import type { GetENSNames } from '../utils/ens-helpers.js'; | import type { GetENSNames } from '../utils/ens-helpers.js'; | ||||
import { | import { | ||||
ET, | ET, | ||||
getEntityTextAsString, | getEntityTextAsString, | ||||
type EntityText, | type EntityText, | ||||
type ThreadEntity, | type ThreadEntity, | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | const { | ||||
parentThreadInfo, | parentThreadInfo, | ||||
childThreadName, | childThreadName, | ||||
childThreadUIName, | childThreadUIName, | ||||
} = input; | } = input; | ||||
const prefix = ET`${ET.user({ userInfo: creator })}`; | const prefix = ET`${ET.user({ userInfo: creator })}`; | ||||
let body = `created a new ${threadNoun(threadType, parentThreadInfo.id)}`; | let body = `created a new ${threadNoun(threadType, parentThreadInfo.id)}`; | ||||
if (parentThreadInfo.name) { | if (parentThreadInfo.name && parentThreadInfo.type !== threadTypes.GENESIS) { | ||||
body = ET`${body} in ${parentThreadInfo.name}`; | body = ET`${body} in ${parentThreadInfo.name}`; | ||||
} | } | ||||
let merged = ET`${prefix} ${body}`; | let merged = ET`${prefix} ${body}`; | ||||
if (childThreadName) { | if (childThreadName) { | ||||
merged = ET`${merged} called "${childThreadName}"`; | merged = ET`${merged} called "${childThreadName}"`; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |