aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/features/messages.js9
-rw-r--r--tools/feed-custom-test.js11
2 files changed, 9 insertions, 11 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 1d7874f..3f748f4 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -3423,7 +3423,8 @@ export function messagesFeature(ctx) {
'72bdbc57bdd6dfc4e62685051de8041d148c3c68fe42bf301f71aa6cf53e52fb', // coinos
];
// The Bitcoin feed's follow pack (NIP-51 kind 39089): { pk, d, relays, title }.
- // Until one is chosen the feed reads the #bitcoin topic instead.
+ // Until one is chosen there is no Bitcoin feed — a #bitcoin topic feed was
+ // too noisy to hand a newcomer.
const STARTER_BITCOIN_PACK = null;
async function seedNewIdentity({ onlyIfNoFollows = false } = {}) {
const s = st();
@@ -3431,11 +3432,9 @@ export function messagesFeature(ctx) {
s.seeded = Date.now();
const at = Date.now();
const feeds = [
- STARTER_BITCOIN_PACK
- ? { id: 'starter-bitcoin', name: 'Bitcoin', follows: false, authors: [], packs: [STARTER_BITCOIN_PACK], topics: [], at }
- : { id: 'starter-bitcoin', name: 'Bitcoin', follows: false, authors: [], packs: [], topics: ['bitcoin'], at },
+ STARTER_BITCOIN_PACK ? { id: 'starter-bitcoin', name: 'Bitcoin', follows: false, authors: [], packs: [STARTER_BITCOIN_PACK], topics: [], at } : null,
{ id: 'starter-gardenstr', name: '#gardenstr', follows: false, authors: [], packs: [], topics: ['gardenstr'], at },
- ];
+ ].filter(Boolean);
for (const f of feeds) if (!s.feeds.some((x) => x.id === f.id)) s.feeds.push(f);
save(s);
if (onlyIfNoFollows) {
diff --git a/tools/feed-custom-test.js b/tools/feed-custom-test.js
index 4fe8f19..144f4b1 100644
--- a/tools/feed-custom-test.js
+++ b/tools/feed-custom-test.js
@@ -106,7 +106,7 @@ try {
await sleep(800);
await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => /feed/i.test(n.textContent)); if (e) e.click(); });
await sleep(1200);
- check('the feed opens on Following, with a + chip', JSON.stringify(await chips()) === JSON.stringify(['*Following', 'Bitcoin', '#gardenstr', '+']), JSON.stringify(await chips()));
+ check('the feed opens on Following, with a + chip', JSON.stringify(await chips()) === JSON.stringify(['*Following', '#gardenstr', '+']), JSON.stringify(await chips()));
console.log('\n[a new feed: everyone I follow, on one topic]');
await page.click('.feed-chip.add'); await sleep(300);
@@ -115,7 +115,7 @@ try {
await page.click('input[type=checkbox]');
await type('input[placeholder="#bitcoin #nostr"]', '#Bitcoin, lightning');
await click('save'); await sleep(1500);
- check('the new feed is on screen and selected', JSON.stringify(await chips()) === JSON.stringify(['Following', 'Bitcoin', '#gardenstr', '*Coin talk', '+']), JSON.stringify(await chips()));
+ check('the new feed is on screen and selected', JSON.stringify(await chips()) === JSON.stringify(['Following', '#gardenstr', '*Coin talk', '+']), JSON.stringify(await chips()));
const req = (await page.evaluate(() => window.__reqs)).find((f) => f['#t']);
check('it asks relays for the follows AND the topics', !!req && req.authors?.includes(AUTHOR) && JSON.stringify(req['#t']) === JSON.stringify(['bitcoin', 'lightning']), JSON.stringify(req || null));
const tagged = signed('fresh #bitcoin post', 0, [['t', 'bitcoin']]);
@@ -130,8 +130,7 @@ try {
await page.evaluate(() => [...document.querySelectorAll('.feed-chip')].find((c) => c.textContent.trim() === 'Following').click()); await sleep(1200);
check('Following again, with its own posts', (await chips())[0] === '*Following' && await waitText('plain post', 4000));
await page.evaluate(() => { const a = [...document.querySelectorAll('.notes-feed a')].find((x) => x.textContent === '#bitcoin'); if (a) a.click(); }); await sleep(1200);
- // a saved single-topic feed with that tag (the starter Bitcoin feed) is reused rather than a session one
- check('a #tag opens the saved feed for that topic', JSON.stringify(await chips()) === JSON.stringify(['Following', '*Bitcoin', '#gardenstr', 'Coin talk', '+']) && await page.evaluate(() => ![...document.querySelectorAll('button')].find((b) => /save feed/i.test(b.textContent))), JSON.stringify(await chips()));
+ check('a #tag opens a topic feed of its own', JSON.stringify(await chips()) === JSON.stringify(['Following', '#gardenstr', 'Coin talk', '*#bitcoin', '+']) && await page.evaluate(() => !![...document.querySelectorAll('button')].find((b) => /save feed/i.test(b.textContent))), JSON.stringify(await chips()));
const treq = (await page.evaluate(() => window.__reqs)).filter((f) => f['#t'] && !f.authors).pop();
check('...asked for by topic alone', !!treq && JSON.stringify(treq['#t']) === JSON.stringify(['bitcoin']), JSON.stringify(treq || null));
@@ -160,14 +159,14 @@ try {
await waitText('receive', 20000);
await page.evaluate(() => { const b = [...document.querySelectorAll('button')].find((e) => /message/i.test(e.getAttribute('aria-label') || '')); if (b) b.click(); }); await sleep(800);
await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => /feed/i.test(n.textContent)); if (e) e.click(); }); await sleep(1200);
- check('the saved feeds are still there; the session topic is not', JSON.stringify(await chips()) === JSON.stringify(['*Following', 'Bitcoin', '#gardenstr', 'Coin talk', 'Pack feed', '+']), JSON.stringify(await chips()));
+ check('the saved feeds are still there; the session topic is not', JSON.stringify(await chips()) === JSON.stringify(['*Following', '#gardenstr', 'Coin talk', 'Pack feed', '+']), JSON.stringify(await chips()));
check('the home list shows the pack feed with its pack', await page.evaluate(() => { const b = document.querySelector('.chat-back'); if (b) b.click(); return !!b; }) && await waitText('test pack', 3000));
await page.evaluate(() => { const e = [...document.querySelectorAll('.item')].find((n) => (n.querySelector('.chat-name') || {}).textContent === 'Feed'); if (e) e.click(); }); await sleep(800);
await page.evaluate(() => [...document.querySelectorAll('.feed-chip')].find((c) => c.textContent.trim() === 'Coin talk').click()); await sleep(800);
await page.evaluate(() => [...document.querySelectorAll('button')].find((b) => /edit feed/i.test(b.getAttribute('aria-label') || '')).click()); await sleep(400);
check('the editor shows what was saved', await page.evaluate(() => document.querySelector('input[placeholder="#bitcoin #nostr"]').value === '#bitcoin #lightning' && document.querySelector('input[type=checkbox]').checked));
await click('delete feed'); await sleep(1000);
- check('deleting it lands back on Following', JSON.stringify(await chips()) === JSON.stringify(['*Following', 'Bitcoin', '#gardenstr', 'Pack feed', '+']), JSON.stringify(await chips()));
+ check('deleting it lands back on Following', JSON.stringify(await chips()) === JSON.stringify(['*Following', '#gardenstr', 'Pack feed', '+']), JSON.stringify(await chips()));
check('no page errors', errs.length === 0, errs.slice(0, 2).join(' | '));
} finally { await browser.close(); server.stop(true); }
console.log(ok ? '\n✅ feeds: Following is one of many' : '\n❌ failed');