diff options
| author | Adam Soltys <[email protected]> | 2026-09-14 14:47:06 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-09-14 14:47:06 -0700 |
| commit | 3f3dee6c3d0f8507e15a1151ce211c15a3ea4577 (patch) | |
| tree | 78d52936d095ecc40a3d6fe862bc4b047a3d1072 /src/features | |
| parent | cebec751bbb6d688089a94d4ac9d8e91f67b307e (diff) | |
| download | coinosv3-3f3dee6c3d0f8507e15a1151ce211c15a3ea4577.tar.gz coinosv3-3f3dee6c3d0f8507e15a1151ce211c15a3ea4577.zip | |
A notification's excerpt names the people it mentions.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QYJfZ4A1TDCEY4Foq3CApR
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/messages.js | 11 |
1 files changed, 9 insertions, 2 deletions
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); |
