aboutsummaryrefslogtreecommitdiffstats
path: root/src/public-chat.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-15 09:33:36 -0700
committerAdam Soltys <[email protected]>2026-09-15 09:33:36 -0700
commit8f3ef61e4fbaf8c7cf586ed1280fd8f4bdc624ae (patch)
tree086ffb149929f5e1f62136f609b48be0c34f2c04 /src/public-chat.js
parentc90d0f3c600802b5b4b43959df5fd2d02f78012c (diff)
downloadcoinosv3-8f3ef61e4fbaf8c7cf586ed1280fd8f4bdc624ae.tar.gz
coinosv3-8f3ef61e4fbaf8c7cf586ed1280fd8f4bdc624ae.zip
A reply's quoted line shows its custom emoji as pictures.
The quote above a reply bubble, the composer's reply bar, and the same on the public /chat page rendered the raw :shortcode:. They now run the one-line snippet through the same NIP-30 tokenizer, cutting on text so a shortcode is never sliced in half. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JuwQqNWtDJcxPWtEm9134z
Diffstat (limited to 'src/public-chat.js')
-rw-r--r--src/public-chat.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/public-chat.js b/src/public-chat.js
index 4d79010..91ded5b 100644
--- a/src/public-chat.js
+++ b/src/public-chat.js
@@ -45,6 +45,12 @@ const LINK_SPLIT = /(https?:\/\/[^\s]+|nostr:(?:npub|nprofile|note|nevent|naddr)
const emojiImg = (code, url) => h('img', { class: 'cemoji', src: url, alt: ':' + code + ':', title: ':' + code + ':', loading: 'lazy' });
// `em` is the message's ["emoji", code, url] map; a :code: it names renders
// as its picture, anything else stays text
+// a reply's quoted line: one line, cut at 90, its custom emoji as pictures
+function quoteNodes(rumor) {
+ const em = emojiTagMap(rumor && rumor.tags);
+ const one = String((rumor && rumor.content) || '').replace(/\s+/g, ' ').trim().slice(0, 90);
+ return splitEmoji(one, (c) => em.get(c)).map((p) => (typeof p === 'string' ? p : emojiImg(p.code, p.url)));
+}
function linkedBody(text, em = null) {
const out = [];
const emojiAt = em && em.size ? (c) => em.get(c) : null;
@@ -263,8 +269,7 @@ export function mountPublicChat() {
? (byChannel.get(activeChannel) || new Map()).get(replyId) : null;
const quote = replySrc ? h('div', { class: 'chat-quote' },
h('span', { class: 'chat-quote-name' }, nameOf(replySrc.author)),
- h('span', { class: 'chat-quote-text' },
- String(replySrc.rumor.content || '').replace(/\s+/g, ' ').slice(0, 90))) : null;
+ h('span', { class: 'chat-quote-text' }, ...quoteNodes(replySrc.rumor))) : null;
log.append(h('div', { class: 'chat-row' + (grouped ? ' grouped' : '') },
grouped ? h('div', { class: 'chat-avatar spacer' }) : avatar(m.author),
h('div', { class: 'chat-body' },