diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index 75092e4..8cf190a 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -399,18 +399,31 @@ export function ChatViewer({ if (conversation?.type !== "live-chat" || !messages) { return conversation?.participants || []; } - // Get unique pubkeys from messages - const pubkeys = new Set(); + + const hostPubkey = liveActivity?.hostPubkey; + const participants: { pubkey: string; role: "host" | "member" }[] = []; + + // Host always first + if (hostPubkey) { + participants.push({ pubkey: hostPubkey, role: "host" }); + } + + // Add other participants from messages (excluding host) + const seen = new Set(hostPubkey ? [hostPubkey] : []); for (const msg of messages) { - if (msg.type !== "system") { - pubkeys.add(msg.author); + if (msg.type !== "system" && !seen.has(msg.author)) { + seen.add(msg.author); + participants.push({ pubkey: msg.author, role: "member" }); } } - return Array.from(pubkeys).map((pubkey) => ({ - pubkey, - role: "member" as const, - })); - }, [conversation?.type, conversation?.participants, messages]); + + return participants; + }, [ + conversation?.type, + conversation?.participants, + messages, + liveActivity?.hostPubkey, + ]); if (!conversation) { return ( diff --git a/src/components/chat/RelaysDropdown.tsx b/src/components/chat/RelaysDropdown.tsx index d83be45..049d58e 100644 --- a/src/components/chat/RelaysDropdown.tsx +++ b/src/components/chat/RelaysDropdown.tsx @@ -24,8 +24,15 @@ export function RelaysDropdown({ conversation }: RelaysDropdownProps) { // Get relays for this conversation const relays: string[] = []; - // NIP-29: Single group relay - if (conversation.metadata?.relayUrl) { + // NIP-53: Multiple relays from liveActivity + const liveActivityRelays = conversation.metadata?.liveActivity?.relays as + | string[] + | undefined; + if (liveActivityRelays?.length) { + relays.push(...liveActivityRelays); + } + // NIP-29: Single group relay (fallback) + else if (conversation.metadata?.relayUrl) { relays.push(conversation.metadata.relayUrl); }