Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Settings search on the web no longer offers the phone-only Gym reminder page (#614)

Duarte Santos7c13487592e0
diff --git a/frontend/src/views/settings-pages.js b/frontend/src/views/settings-pages.js
index 7d772f798..d10c5e159 100644
--- a/frontend/src/views/settings-pages.js
+++ b/frontend/src/views/settings-pages.js
@@ -202,8 +202,9 @@ export function searchSettings(query, ctx, tr = t) {
hits.push({ ...entry, label: title, trail: isPage ? tr('Settings') : pageTrail(entry.page, tr), isPage, rank })
}
for (const id of PAGE_IDS) {
+ // The page itself too: Gym reminder hangs under Reminders, which the web has, but is the phone's.
const top = PAGES[id].parent ? PAGES[id].parent : id
- if (!pageVisible(top, ctx) || id === 'advanced') continue
+ if (!pageVisible(top, ctx) || !pageVisible(id, ctx) || id === 'advanced') continue
consider({ page: id, title: PAGES[id].title, icon: PAGES[id].icon, tint: PAGES[id].tint }, true)
}
for (const e of SEARCH) {
diff --git a/frontend/src/views/settings-pages.test.jsx b/frontend/src/views/settings-pages.test.jsx
index b258fd4d8..e78586dff 100644
--- a/frontend/src/views/settings-pages.test.jsx
+++ b/frontend/src/views/settings-pages.test.jsx
@@ -212,6 +212,16 @@ describe('the search lands on a row', () => {
expect(searchSettings('backup folder', { ...guestWeb, mobile: true, android: true }, tr)).toEqual([])
})
+ // Checked in Chrome, signed in on the web: "gym" offered the Gym reminder page, a phone-only
+ // page whose tap only bounced back to Settings. Its parent (Reminders) is there on the web.
+ it('never offers a page this device does not have, even under a parent it has', () => {
+ const tr = s => s
+ const web = { ...guestWeb, user: { id: 'u' }, synced: true, pushOK: true }
+ expect(pageVisible('reminders', web)).toBe(true)
+ expect(searchSettings('gym reminder', web, tr).map(h => h.title)).not.toContain('Gym reminder')
+ expect(searchSettings('gym reminder', { ...web, mobile: true }, tr).map(h => h.title)).toContain('Gym reminder')
+ })
+
it('a web reminder row waits for push to answer, and flashes Push notifications when it stays off', async () => {
vi.useFakeTimers()
try {