Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(help): the collection helper belongs beside the scripts, not inside them

Maurice05b453b493e7
diff --git a/client/e2e/help/trip-place.guide.ts b/client/e2e/help/trip-place.guide.ts
index 1a610244c..01f6fd207 100644
--- a/client/e2e/help/trip-place.guide.ts
+++ b/client/e2e/help/trip-place.guide.ts
@@ -113,6 +113,26 @@ const closeModal = async (page: Page): Promise<void> => {
const only = (target: (p: Page) => Locator) => ({ target })
+/**
+ * Take a place out of every collection it sits in.
+ *
+ * Run before the guide as well as after it: the Collections screen's own guides
+ * run earlier in the suite and leave places saved, and a place that is already
+ * in a list offers Saved where this guide's first step looks for Save to
+ * Collection.
+ */
+async function unsaveEverywhere(page: Page, name: string): Promise<void> {
+ const place = await findPlace(page, name)
+ if (!place) return
+ const query = new URLSearchParams({ name: place.name, lat: String(place.lat ?? ''), lng: String(place.lng ?? '') })
+ const res = await page.request.get(`/api/addons/collections/membership?${query.toString()}`)
+ if (!res.ok()) return
+ const body = (await res.json()) as { lists?: { place_id: number }[] }
+ for (const entry of body.lists ?? []) {
+ await page.request.delete(`/api/addons/collections/places/${entry.place_id}`)
+ }
+}
+
const SCRIPTS: Record<string, GuideScript> = {
'read-place': {
guide: guide('read-place'),
@@ -384,26 +404,6 @@ const SCRIPTS: Record<string, GuideScript> = {
only(p => footer(p).getByRole('button', { name: 'Open Website' })),
],
},
-/**
- * Take a place out of every collection it sits in.
- *
- * Run before the guide as well as after it: the Collections screen's own guides
- * run earlier in the suite and leave places saved, and a place that is already
- * in a list offers Saved where this guide's first step looks for Save to
- * Collection.
- */
-async function unsaveEverywhere(page: Page, name: string): Promise<void> {
- const place = await findPlace(page, name)
- if (!place) return
- const query = new URLSearchParams({ name: place.name, lat: String(place.lat ?? ''), lng: String(place.lng ?? '') })
- const res = await page.request.get(`/api/addons/collections/membership?${query.toString()}`)
- if (!res.ok()) return
- const body = (await res.json()) as { lists?: { place_id: number }[] }
- for (const entry of body.lists ?? []) {
- await page.request.delete(`/api/addons/collections/places/${entry.place_id}`)
- }
-}
-
'place-to-collection': {
guide: guide('place-to-collection'),
start: async p => {