Pass relay and author hints from nevent1 to EmbeddedNote
When a nostr:nevent1 URI is decoded in NoteContent, the relay hints and author pubkey embedded in the identifier were being discarded. This meant EmbeddedNote would only query the user's configured relays and skip the relay hints, causing quoted events hosted on other relays to silently fail to load. Now the hints are stored in the nevent-embed token and forwarded to EmbeddedNote → useEvent.
This commit is contained in:
@@ -61,6 +61,10 @@ function parseEmbedSegments(text: string): EmbedSegment[] {
|
||||
interface EmbeddedNoteProps {
|
||||
/** Hex event ID to fetch and display. */
|
||||
eventId: string;
|
||||
/** Optional relay hints from the nevent1 identifier. */
|
||||
relays?: string[];
|
||||
/** Optional author pubkey hint from the nevent1 identifier. */
|
||||
authorHint?: string;
|
||||
className?: string;
|
||||
/** When true, ProfileHoverCards inside the card are disabled to prevent nested hover cards. */
|
||||
disableHoverCards?: boolean;
|
||||
@@ -70,8 +74,8 @@ interface EmbeddedNoteProps {
|
||||
const MAX_CONTENT_LENGTH = 280;
|
||||
|
||||
/** Inline embedded note card – similar to a link preview but for Nostr events. */
|
||||
export function EmbeddedNote({ eventId, className, disableHoverCards }: EmbeddedNoteProps) {
|
||||
const { data: event, isLoading, isError } = useEvent(eventId);
|
||||
export function EmbeddedNote({ eventId, relays, authorHint, className, disableHoverCards }: EmbeddedNoteProps) {
|
||||
const { data: event, isLoading, isError } = useEvent(eventId, relays, authorHint);
|
||||
|
||||
if (isLoading) {
|
||||
return <EmbeddedNoteSkeleton className={className} />;
|
||||
|
||||
@@ -152,7 +152,7 @@ type ContentToken =
|
||||
| { type: 'inline-link'; url: string }
|
||||
| { type: 'youtube-embed'; videoId: string }
|
||||
| { type: 'mention'; pubkey: string }
|
||||
| { type: 'nevent-embed'; eventId: string }
|
||||
| { type: 'nevent-embed'; eventId: string; relays?: string[]; author?: string }
|
||||
| { type: 'naddr-embed'; addr: AddrCoords; url?: string }
|
||||
| { type: 'nostr-link'; id: string; raw: string }
|
||||
| { type: 'hashtag'; tag: string; raw: string };
|
||||
@@ -296,7 +296,12 @@ export function NoteContent({
|
||||
} else if (decoded.type === 'note') {
|
||||
result.push({ type: 'nevent-embed', eventId: decoded.data as string });
|
||||
} else if (decoded.type === 'nevent') {
|
||||
result.push({ type: 'nevent-embed', eventId: (decoded.data as { id: string }).id });
|
||||
result.push({
|
||||
type: 'nevent-embed',
|
||||
eventId: decoded.data.id,
|
||||
relays: decoded.data.relays,
|
||||
author: decoded.data.author,
|
||||
});
|
||||
} else if (decoded.type === 'naddr') {
|
||||
result.push({ type: 'naddr-embed', addr: decoded.data as AddrCoords });
|
||||
} else {
|
||||
@@ -446,7 +451,7 @@ export function NoteContent({
|
||||
case 'youtube-embed':
|
||||
return <YouTubeEmbed key={i} videoId={token.videoId} className="my-2.5" />;
|
||||
case 'nevent-embed':
|
||||
return <EmbeddedNote key={i} eventId={token.eventId} className="my-2.5" />;
|
||||
return <EmbeddedNote key={i} eventId={token.eventId} relays={token.relays} authorHint={token.author} className="my-2.5" />;
|
||||
case 'naddr-embed':
|
||||
return (
|
||||
<span key={i}>
|
||||
|
||||
Reference in New Issue
Block a user