aboutsummaryrefslogtreecommitdiffstats
path: root/tools/feed-live-test.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/feed-live-test.js')
-rw-r--r--tools/feed-live-test.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/feed-live-test.js b/tools/feed-live-test.js
index b9879d0..2bee19f 100644
--- a/tools/feed-live-test.js
+++ b/tools/feed-live-test.js
@@ -58,8 +58,10 @@ await page.evaluateOnNewDocument(() => {
subs.push([ws, m[1]]);
// A catch-up query (no since, no until) is answered from the queue
// the test filled, ahead of the real relay's end-of-stream.
- if (!m[2].since && !m[2].until && (window.__catchup || []).length) {
- const evs = window.__catchup; window.__catchup = [];
+ // (only to an ask that names their author: the feed also asks for your own posts)
+ const wants = (ev) => !m[2].authors || m[2].authors.includes(ev.pubkey);
+ if (!m[2].since && !m[2].until && (window.__catchup || []).some(wants)) {
+ const evs = window.__catchup.filter(wants); window.__catchup = window.__catchup.filter((ev) => !wants(ev));
setTimeout(() => { for (const ev of evs) ws.dispatchEvent(new MessageEvent('message', { data: JSON.stringify(['EVENT', m[1], ev]) })); }, 0);
}
}