From a08f48d67ad61eba5077fdb1a01d19fe5eea0fdb Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 5 Oct 2026 21:11:32 -0700 Subject: A quote inside a quote shows as a one-line preview (author + start of the text) instead of a bare 'view note' link Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YRC6aKhwAud231ot9FPmhi --- src/features/messages.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/features') diff --git a/src/features/messages.js b/src/features/messages.js index e97fa37..7f71264 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -6901,6 +6901,24 @@ export function messagesFeature(ctx) { return out; } + // A quote inside a quote: one line of who and what, never a third level + // of cards (a bare "view note" link said nothing about where it leads). + function quoteMini(ref) { + let c = feedPaint ? feedPaint.quotes.get(ref.id) : null; + if (!c?.ev) { + c = quotedNote(ref); + if (feedPaint && c.ev) feedPaint.quotes.set(ref.id, { ...c }); + } + const open = (e) => { e.preventDefault(); e.stopPropagation(); if (c.ev) openNoteThread(c.ev); else openNoteRef(ref); }; + if (!c.ev || hidden(c.ev)) return h('a', { href: '#', class: 'quote-mini small', onClick: open }, + t(c.status === 'loading' ? 'noteRefLoading' : 'noteRefLink')); + const words = plainExcerpt(c.ev.content.replace(/https?:\/\/\S+|nostr:(note|nevent|naddr)1[a-z0-9]+/gi, ' ')); + return h('div', { class: 'quote-mini clickable', onClick: open }, + avatar(c.ev.pubkey, 'chat-avatar mini', false), + h('span', { class: 'quote-name' }, displayName(c.ev.pubkey)), + h('span', { class: 'small muted quote-mini-text' }, words || '\u2026')); + } + // One URL, rendered as whatever it points at. `isImage` is markdown saying // so outright — plenty of perfectly good picture URLs carry no extension // (a CDN path, a /media/ route), and ![…] is the author telling us what it @@ -7280,7 +7298,7 @@ export function messagesFeature(ctx) { if (ref && ref.type === 'event') { // the note they're quoting, shown inside what they said about it — // except one level down, where it goes back to being a link - out.push(depth ? h('a', { + out.push(depth === 1 ? quoteMini(ref) : depth ? h('a', { href: '#', onClick: (e) => { e.preventDefault(); e.stopPropagation(); openNoteRef(ref); }, }, t('noteRefLink')) : quoteCard(ref, depth)); } else out.push(h('span', { class: 'faint' }, part.slice(6, 18) + '…')); -- cgit v1.2.3