|
1 | 1 | import { workflowLabel } from "../../features/relay/workflow-attribution"; |
2 | | -import { useIdentityNames } from "../../features/identity-names/react"; |
| 2 | +import { |
| 3 | + useIdentityNames, |
| 4 | + useNamesRevision, |
| 5 | +} from "../../features/identity-names/react"; |
3 | 6 | import { npubEncode } from "nostr-tools/nip19"; |
4 | 7 | import { |
5 | 8 | useEffect, |
@@ -88,6 +91,7 @@ function conversationName( |
88 | 91 |
|
89 | 92 | /** The most rows the People and Agents groups each show. */ |
90 | 93 | const PERSON_ROWS = 6; |
| 94 | +const noMembers: readonly string[] = []; |
91 | 95 |
|
92 | 96 | /** "Search in this conversation" narrows the search and "Show more messages" |
93 | 97 | * extends it; neither is a result. */ |
@@ -331,6 +335,8 @@ export function SearchResults({ |
331 | 335 | peopleActive, |
332 | 336 | ); |
333 | 337 | useMentionArchives(session, showAuthorPicker || peopleActive); |
| 338 | + // People labels come from one names scope built each render. |
| 339 | + useNamesRevision(session.names, peopleActive); |
334 | 340 | // The viewer's own agents open a new chat, not a direct message: the |
335 | 341 | // same agents the new-chat composer accepts. Their earlier chats |
336 | 342 | // still show as conversations. |
@@ -599,13 +605,14 @@ export function SearchResults({ |
599 | 605 | name: person.name, |
600 | 606 | ...(person.isAgent ? { isAgent: true } : {}), |
601 | 607 | })); |
| 608 | + const named = session.names?.scope(candidates, displayFacts); |
602 | 609 | for (const { pubkey, source, agent } of eligible) { |
603 | 610 | const dm = relationships.dm(pubkey); |
604 | 611 | const agentName = |
605 | 612 | messageableAgents.get(pubkey)?.name ?? sessionAgents.get(pubkey)?.name; |
606 | 613 | people.push({ |
607 | 614 | pubkey, |
608 | | - label: resolveName(pubkey, source.name, candidates, displayFacts), |
| 615 | + label: named?.(pubkey)?.name ?? source.name, |
609 | 616 | username: source.username, |
610 | 617 | agentName: agentName !== source.name ? agentName : undefined, |
611 | 618 | agent, |
@@ -977,7 +984,7 @@ export function SearchResults({ |
977 | 984 | displayId, |
978 | 985 | profiles.get(displayId)?.name ?? displayId.slice(0, 10), |
979 | 986 | list.channels.find((channel) => channel.id === message.channelId) |
980 | | - ?.members ?? [], |
| 987 | + ?.members ?? noMembers, |
981 | 988 | ); |
982 | 989 | return { |
983 | 990 | key: message.id, |
|
0 commit comments