MCPcopy Create free account
hub / github.com/block/buzz / getThreadReference

Function getThreadReference

desktop/src/features/messages/lib/threading.ts:25–52  ·  view source on GitHub ↗
(tags: string[][])

Source from the content-addressed store, hash-verified

23}
24
25export function getThreadReference(tags: string[][]): ThreadReference {
26 const eventTags = getEventTags(tags);
27
28 if (eventTags.length === 0) {
29 return {
30 parentId: null,
31 rootId: null,
32 };
33 }
34
35 const rootTag = eventTags.find((tag) => tag[3] === "root");
36 const replyTag =
37 [...eventTags].reverse().find((tag) => tag[3] === "reply") ?? null;
38
39 if (!replyTag) {
40 return {
41 parentId: null,
42 rootId: null,
43 };
44 }
45
46 const parentId = replyTag[1] ?? null;
47
48 return {
49 parentId,
50 rootId: rootTag?.[1] ?? parentId,
51 };
52}
53
54/**
55 * Best-effort client-side normalization of mention pubkeys: lowercase, deduplicate, skip self.

Callers 15

feedItemThreadRootIdFunction · 0.90
shouldNotifyForEventFunction · 0.90
isUnreadExternalEventFunction · 0.90
useUnreadChannelsFunction · 0.90
ChannelScreenFunction · 0.90
getThreadRootIdFunction · 0.90
useInboxThreadContextFunction · 0.90
getInboxThreadRootIdFunction · 0.90
isThreadActivityItemFunction · 0.90

Calls 1

getEventTagsFunction · 0.85

Tested by

no test coverage detected