From 3f3dee6c3d0f8507e15a1151ce211c15a3ea4577 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 14 Sep 2026 14:47:06 -0700 Subject: A notification's excerpt names the people it mentions. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01QYJfZ4A1TDCEY4Foq3CApR --- src/features/messages.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/features/messages.js b/src/features/messages.js index 215a6c9..9e0c3e9 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -5281,6 +5281,13 @@ export function messagesFeature(ctx) { const q = quotedNote({ id, relays: [] }); return q.ev || null; } + // A one-line excerpt: mentions read as names, not as nostr:nprofile1… keys. + function plainExcerpt(text) { + return String(text || '').replace(/nostr:(npub|nprofile)1[a-z0-9]+/gi, (m) => { + const ref = parseNostrRef(m.slice(6)); + return ref && ref.type === 'pubkey' ? '@' + displayName(ref.pk) : m.slice(6, 18) + '\u2026'; + }).replace(/\s+/g, ' ').trim(); + } function notifLabel(x) { if (x.what === 'zap') return t('alertZap', { sats: fmtSats(x.sats) + ' sats' }); if (x.what === 'react') return t('alertReact', { emoji: x.emoji }); @@ -5292,8 +5299,8 @@ export function messagesFeature(ctx) { profileOf(x.actor); const target = x.what === 'reply' || x.what === 'mention' ? null : notifTarget(x.target); const excerpt = x.what === 'reply' || x.what === 'mention' - ? x.text - : target ? String(target.content || '').slice(0, 140) : null; + ? plainExcerpt(x.text) + : target ? plainExcerpt(String(target.content || '').slice(0, 140)) : null; const open = () => { if (x.what === 'reply' || x.what === 'mention') { const ev = notifNotes.get(x.id); -- cgit v1.2.3