diff options
Diffstat (limited to 'src/features/messages.js')
| -rw-r--r-- | src/features/messages.js | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 598ff39..a3c7cd5 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -11789,16 +11789,33 @@ export function messagesFeature(ctx) { // before the next post's — for the pager opened from one in the feed: the // feed's own list (its order, its moderation), not the media index. Clips // of every shape, not only the tall ones the Videos view flips through. + // The posts a post quotes (drawn inside it), as far as they've been fetched. + function quotedIn(ev) { + const out = []; + for (const m of String(ev.content || '').matchAll(/nostr:((?:note|nevent)1[a-z0-9]+)/gi)) { + const ref = parseNostrRef(m[1].toLowerCase()); + const q = ref && ref.type === 'event' && quoted.get(ref.id); + if (q && q.ev && FEED_KINDS.includes(q.ev.kind) && !hidden(q.ev) && !out.includes(q.ev)) out.push(q.ev); + } + return out; + } function feedMediaItems(c, kind) { const out = []; const list = c.winList ? c.winList() : c.notes; + const sensitive = (e) => modOn('sensitive') && sensitiveWhy(e) !== null && !isMe(e.pubkey); + const add = (e, row) => { + if (kind === 'videos') learnVideoMeta(e); + const urls = kind === 'videos' ? clipUrlsOf(e) + : noteMediaUrls(e.content).filter((u) => !u.startsWith('https://i.ytimg.com/')); + for (const url of urls) out.push({ ev: e, url, row }); + }; for (const row of list) { const ev = row.kind === REPOST ? repostInner(row) || row : row; - if (modOn('sensitive') && sensitiveWhy(ev) !== null && !isMe(ev.pubkey)) continue; - if (kind === 'videos') learnVideoMeta(ev); - const urls = kind === 'videos' ? clipUrlsOf(ev) - : noteMediaUrls(ev.content).filter((u) => !u.startsWith('https://i.ytimg.com/')); - for (const url of urls) out.push({ ev, url, row }); + if (sensitive(ev)) continue; + add(ev, row); + // then the pictures (clips) of the posts it quotes, which are drawn + // inside it: tapped there, one opened alone, with nothing to swipe to + for (const q of quotedIn(ev)) if (!sensitive(q)) add(q, row); } return out; } |
