diff options
| author | Adam Soltys <[email protected]> | 2026-10-05 21:11:32 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-05 21:11:32 -0700 |
| commit | a08f48d67ad61eba5077fdb1a01d19fe5eea0fdb (patch) | |
| tree | 36a16e9662f6b337e81976fc4f61dff553da0576 /src/features/messages.js | |
| parent | 690a3c177778bdbdee61da5285745e39cfc2be33 (diff) | |
| download | coinosv3-a08f48d67ad61eba5077fdb1a01d19fe5eea0fdb.tar.gz coinosv3-a08f48d67ad61eba5077fdb1a01d19fe5eea0fdb.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YRC6aKhwAud231ot9FPmhi
Diffstat (limited to 'src/features/messages.js')
| -rw-r--r-- | src/features/messages.js | 20 |
1 files changed, 19 insertions, 1 deletions
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) + '…')); |
