From 526ccc86e4a143f0a4bd0188975d9089e26a8ee5 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 9 Oct 2026 16:07:18 -0700 Subject: Zap receipts read as zaps. A receipt (9735, or coinos's 9737) reached as a note — someone reacted to a zap, and the reaction was followed — showed as "a kind 9735 event this app doesn't show" under the LNURL server's name. It now shows the zapper's face and name, "⚡ zapped 21 sats" and what they said with it. tools/zap-receipt-row-test.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Vps2H27rhbG9ZqseGfMrc3 --- src/features/messages.js | 16 +++++++++++++--- src/i18n.js | 1 + src/style.css | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/features/messages.js b/src/features/messages.js index abbbf74..d4d5c43 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -9304,6 +9304,12 @@ export function messagesFeature(ctx) { } function noteRow(pk, ev, name, { open = true, focus = false, joined = false } = {}) { + // A zap receipt (9735, or coinos's 9737) reached as a reply or through a + // reaction to it — some clients let you react to a zap — is the zap, not + // a post by the lightning server that signed it: the zapper's face and + // name, what they sent, what they said with it. + const zapRec = ev.kind === 9735 || ev.kind === 9737; + if (zapRec) { const z = zapperOf(ev); if (z) { pk = z; name = displayName(z); } } // NOT prefetchProfilePage: that fetches the author's whole page — their // kind 0, their relay list, their last thirty notes — and a feed row is // not a profile tap. Twenty rows meant sixty requests, which is how the @@ -9314,9 +9320,9 @@ export function messagesFeature(ctx) { // An event of a kind this app has no renderer for (a chess game, kind // 64, reached through a reaction to it) is shown as what its author's // client said it is (NIP-31 alt), never as raw content dressed as a post. - const foreign = ev.kind !== 1 && ev.kind !== ARTICLE && ev.kind !== POLL && ev.kind !== COMMENT; + const foreign = ev.kind !== 1 && ev.kind !== ARTICLE && ev.kind !== POLL && ev.kind !== COMMENT && !zapRec; const altText = foreign ? ((ev.tags.find((x) => x[0] === 'alt') || [])[1] || t('noteForeignKind', { kind: ev.kind })) : null; - const isReply = ev.kind === COMMENT || (!foreign && ev.tags.some((x) => x[0] === 'e')); + const isReply = ev.kind === COMMENT || (!foreign && !zapRec && ev.tags.some((x) => x[0] === 'e')); const canZap = canZapPk(pk); // an optimistic post mid-publish: visible but not yet a real event — // dimmed, and no thread/reply/zap until its signed self takes over @@ -9368,7 +9374,11 @@ export function messagesFeature(ctx) { style: 'flex-shrink:0', onClick: (e) => { e.stopPropagation(); ui.noteSheet = ev; render(); }, }, '\u22ef')), - foreign + zapRec + ? h('div', { class: 'note-text', style: 'white-space:pre-wrap;overflow-wrap:anywhere' }, + h('span', { class: 'note-zap-line' }, '\u26a1 ' + t('zapRowText', { n: receiptSats(ev).toLocaleString() })), + zapText(ev) ? h('div', {}, ...noteBody(zapText(ev))) : null) + : foreign ? h('div', { class: 'note-text small muted', style: 'white-space:pre-wrap;overflow-wrap:anywhere' }, (ev.kind === 64 ? '\u265f ' : '') + altText) : h('div', { class: 'note-text', style: 'white-space:pre-wrap;overflow-wrap:anywhere' }, ...(ev.kind === ARTICLE ? (open ? [articleCard(ev)] : articleBody(ev)) : noteBody(shownTranslation(ev)?.text ?? noteText(ev), 0, noteEmojiTags(ev)))), foreign || pending ? null : translateLine(ev), diff --git a/src/i18n.js b/src/i18n.js index 9df0127..9c3efe3 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -595,6 +595,7 @@ const STR = { arkFeeService: 'Service fee', arkCoinsExpired: 'expired', noteForeignKind: 'A kind {kind} event this app doesn’t show.', + zapRowText: 'zapped {n} sats', pollVoter: '{n} vote', pollVoters: '{n} votes', pollMulti: 'Pick any', diff --git a/src/style.css b/src/style.css index a3abb75..4df04d7 100644 --- a/src/style.css +++ b/src/style.css @@ -1622,3 +1622,5 @@ body::after { cursor: pointer; text-decoration: underline; text-underline-offset: 2px; min-height: 0; } .note-translate-btn:hover { color: var(--ink); } +/* a zap receipt shown as a row: what was sent, in the zap colour */ +.note-zap-line { color: #e6a800; font-weight: 650; } -- cgit v1.2.3