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(demo): the addon policy names the legacy memories row, which stays off

Maurice98961dadd58a
diff --git a/server/src/demo/demo-addon-policy.ts b/server/src/demo/demo-addon-policy.ts
index 440e9d9e7..97ef2a0ee 100644
--- a/server/src/demo/demo-addon-policy.ts
+++ b/server/src/demo/demo-addon-policy.ts
@@ -10,7 +10,8 @@ import type { DemoAddonStates, DemoRepository } from '../db/repositories/DemoRep
* the photo providers under Journey, AirTrail and Dawarich. The AI features
* (the assistant, AI parsing) and the MCP server stay off as well: they spend
* the instance's AI credit or hand out tokens to a shared account, so they are
- * a feature of a self-hosted install, not of the public demo.
+ * a feature of a self-hosted install, not of the public demo. So does the
+ * legacy `memories` row, which nothing reads any more.
*
* Each list names its rows outright instead of "everything but", so a release
* that adds an addon has to decide where it goes: the policy test fails on a
@@ -37,7 +38,18 @@ export const DEMO_ADDON_POLICY = {
// Integrations TREK runs by itself
'naver_list_import',
],
- off: ['airtrail', 'dawarich', 'mcp', 'llm_parsing', 'ai_assistant'],
+ off: [
+ 'airtrail',
+ 'dawarich',
+ 'mcp',
+ 'llm_parsing',
+ 'ai_assistant',
+ // The trip Photos addon of old releases. Its migration seeds the row
+ // switched off and nothing removes it; the client reads Photos from the
+ // photo providers (addonStore's isEnabled) and the admin panel keeps the
+ // row out of its trip list, so it switches nothing.
+ 'memories',
+ ],
},
/** Rows of `photo_providers`, Journey's shelf. */
photoProviders: {
diff --git a/server/tests/unit/demo/demo-addon-policy.test.ts b/server/tests/unit/demo/demo-addon-policy.test.ts
index c4482c3e1..7c10fe3d0 100644
--- a/server/tests/unit/demo/demo-addon-policy.test.ts
+++ b/server/tests/unit/demo/demo-addon-policy.test.ts
@@ -82,9 +82,9 @@ async function expectPolicyApplied(): Promise<void> {
on: [],
off: sorted(DEMO_ADDON_POLICY.documentProviders.off),
});
- for (const [key, value] of Object.entries(DEMO_ADDON_POLICY.appSettings)) {
- expect([key, await readAppSetting(t, key)]).toEqual([key, value]);
- }
+ const keys = Object.keys(DEMO_ADDON_POLICY.appSettings);
+ const values = await Promise.all(keys.map((key) => readAppSetting(t, key)));
+ expect(Object.fromEntries(keys.map((key, i) => [key, values[i]]))).toEqual(DEMO_ADDON_POLICY.appSettings);
}
describe('demo addon policy', () => {
@@ -94,21 +94,22 @@ describe('demo addon policy', () => {
[PhotoProviders, DEMO_ADDON_POLICY.photoProviders],
[DocumentProviders, DEMO_ADDON_POLICY.documentProviders],
] as const;
- for (const [entity, shelf] of shelves) {
- const seeded = (await findRows(t, entity as typeof Addons)).map((r) => r.id).sort();
+ const seeded = await Promise.all(shelves.map(([entity]) => findRows(t, entity as typeof Addons)));
+ shelves.forEach(([, shelf], i) => {
const listed = [...shelf.on, ...shelf.off];
expect(new Set(listed).size).toBe(listed.length);
- expect(sorted(listed)).toEqual(seeded);
- }
+ expect(sorted(listed)).toEqual(seeded[i].map((r) => r.id).sort());
+ });
});
- it('DEMOPOL-002: keeps off exactly what reaches a server of the visitor’s own, and the AI features and MCP', () => {
+ it('DEMOPOL-002: keeps off exactly what reaches a server of the visitor’s own, the AI features, MCP and the legacy Photos row', () => {
expect(sorted(DEMO_ADDON_POLICY.addons.off)).toEqual([
'ai_assistant',
'airtrail',
'dawarich',
'llm_parsing',
'mcp',
+ 'memories',
]);
expect(sorted(DEMO_ADDON_POLICY.photoProviders.off)).toEqual(['immich', 'synologyphotos']);
expect(sorted(DEMO_ADDON_POLICY.documentProviders.off)).toEqual(