mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 17:03:15 +00:00
fix(client): give the desktop halves the same fixes their mobile twins got
Several of the fixes in this branch landed on a mobile screen while the desktop component with the identical bug sat in another package and was left alone, which leaves the two disagreeing about the same handler. So: the appearance tab flushes its debounced write on unmount, the journey share copy guards navigator.clipboard (undefined on a plain-HTTP self-hosted install), the admin collab toggle rolls back from a scoped snapshot instead of a stale one, the reservation modal parses metadata through the guarded helper rather than a bare JSON.parse that takes the route down, and the notification toggle surfaces its failures and stops racing concurrent toggles. The Journey components reached the memories provider-status endpoint with a raw fetch(), past every apiClient interceptor; they go through a small memoriesApi now. And the server half of the OSM menu_url finding: the client renders it through safeHttpUrl, so place-enrichment should not be handing a javascript: value out in the first place. The share section hides itself when the server says the link is not this user's to manage, rather than offering a create button that 403s.
This commit is contained in:
@@ -729,6 +729,19 @@ describe('collectFacts', () => {
|
||||
expect(facts.find((f) => f.kind === 'internetAccess')).toEqual({ kind: 'internetAccess', value: null, url: null });
|
||||
});
|
||||
|
||||
it('ENRICH-052c: drops a menu_url that is not http(s)', () => {
|
||||
// Anyone can edit the OSM tag and the client turns it into an href.
|
||||
for (const menu_url of ['javascript:alert(1)', 'data:text/html,<script>1</script>', 'ftp://host/menu', '']) {
|
||||
expect(collectFacts(osm({ menu_url })).map((f) => f.kind)).toEqual([]);
|
||||
}
|
||||
});
|
||||
|
||||
it('ENRICH-052d: keeps an http menu_url and trims the surrounding whitespace', () => {
|
||||
expect(collectFacts(osm({ menu_url: ' http://example.org/menu ' }))).toEqual([
|
||||
{ kind: 'menu', value: null, url: 'http://example.org/menu' },
|
||||
]);
|
||||
});
|
||||
|
||||
it('ENRICH-053: takes no chips at all from a Google place', () => {
|
||||
expect(collectFacts(null)).toEqual([]);
|
||||
// cuisine/outdoor_seating are OSM tagging and never appear on a Google blob;
|
||||
|
||||
Reference in New Issue
Block a user