aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/features/messages.js12
-rw-r--r--tools/avatar-profile-test.js18
2 files changed, 28 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 3d9b1e9..b14cb75 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -3899,6 +3899,8 @@ export function messagesFeature(ctx) {
const FEED_LS = 'btc-wallet-feed'; // the feed last on screen, remembered per device
const feedStates = new Map(); // id -> state
const adhocFeeds = new Map(); // id -> definition, this session only
+ // the feed of your own you last had on (never a session one)
+ const homeFeedId = () => { let id = FOLLOWING; try { id = localStorage.getItem(FEED_LS) || FOLLOWING; } catch {} return feedDef(id) && !adhocFeeds.has(id) ? id : FOLLOWING; };
let curFeedId = (() => { try { return localStorage.getItem(FEED_LS) || FOLLOWING; } catch { return FOLLOWING; } })();
// Two feeds everyone has: the people you follow, and everything the coinos
// relay carries. Each remembers its own relay choice in the state.
@@ -7993,9 +7995,12 @@ export function messagesFeature(ctx) {
// A destination tab is a destination: tapping Feed while already
// there always returns to its top. Only the explicit "x new posts"
// pill jumps to the first unread arrival.
- if (active === 'feed' && ui.msgView === 'feed' && !ui.profilePk && !ui.noteThread && !ui.feedEdit) { glideToTop(); return; }
+ // (someone's timeline or a #tag opened from a post isn't the Feed
+ // tab — the tab is your own feeds, the one you last had on)
+ const own = adhocFeeds.has(curFeedId) ? homeFeedId() : curFeedId;
+ if (active === 'feed' && ui.msgView === 'feed' && !ui.profilePk && !ui.noteThread && !ui.feedEdit && own === curFeedId) { glideToTop(); return; }
leavePage();
- if (visitor) { ui.pubProf = true; openFirehose(); } else showFeed(curFeedId);
+ if (visitor) { ui.pubProf = true; openFirehose(); } else showFeed(own);
window.scrollTo({ top: 0 });
}),
button('messages', t('msgDmsTitle'), '<path d="M21 11.5a8.4 8.4 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.4 8.4 0 0 1-3.8-.9L3 21l1.9-5.7a8.4 8.4 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.4 8.4 0 0 1 3.8-.9h.5a8.5 8.5 0 0 1 8 8z"/>', () => {
@@ -8060,6 +8065,9 @@ export function messagesFeature(ctx) {
h('div', { class: 'row gap6', style: 'align-items:center' },
backBtn(() => {
stopFeedWatch();
+ // a feed opened from somewhere (a profile's timeline, a #tag, a
+ // pack link) goes back there — or, reached directly, to yours
+ if (!visitor && adhocFeeds.has(def.id)) { ctx.goBack(() => { ui.chatOpen = true; ui.msgView = 'feed'; selectFeed(homeFeedId()); }); return; }
if (visitor) { ui.chatOpen = false; ui.msgView = null; ui.pubProf = null; } else ui.msgView = 'home';
render();
}),
diff --git a/tools/avatar-profile-test.js b/tools/avatar-profile-test.js
index 54c40dc..293d7c1 100644
--- a/tools/avatar-profile-test.js
+++ b/tools/avatar-profile-test.js
@@ -88,6 +88,24 @@ try {
const chip = await page.evaluate(() => document.querySelector('.feed-chip.on')?.textContent || null);
check('someone’s timeline has a labelled chip', !!chip && /Bob Poster/.test(chip), JSON.stringify(chip));
+ // ‹ on their timeline goes back to their profile, not the chat list
+ await page.evaluate(() => document.querySelector('.feed-page .chat-back').click());
+ await sleep(1200);
+ const backTo = await page.evaluate(() => ({ profile: /bob bio here/.test(document.body.innerText), chats: /Communities/.test(document.body.innerText) && !document.querySelector('.feed-page') }));
+ check('‹ on someone’s timeline goes back to their profile', backTo.profile && !backTo.chats, JSON.stringify(backTo));
+ // ...and from their timeline, the Feed tab is your own feed again
+ await click('their timeline');
+ await sleep(1500);
+ await page.evaluate(() => document.querySelector('.app-bottom-nav .app-nav-button').click());
+ await sleep(1200);
+ const mine = await page.evaluate(() => document.querySelector('.feed-chip.on')?.textContent || null);
+ check('the Feed tab brings back your own feed', mine === 'Following', JSON.stringify(mine));
+ // back onto their timeline for the save below
+ await page.evaluate(() => { const r = [...document.querySelectorAll('.notes-feed .note-avatar')].find((n) => n.closest('[data-key]')?.innerText.includes('Bob Poster')); r.click(); });
+ await sleep(1000);
+ await click('their timeline');
+ await sleep(1500);
+
// ⋯ → Save feed: straight into the chips, no editor listing their follows
await page.evaluate((l) => document.querySelector('button[aria-label="' + l + '"]').click(), 'Feed options');
await sleep(500);