diff --git a/CHANGELOG.md b/CHANGELOG.md index 247d6a88c..46a79c5b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 26.11.1 + +### Fixed + +- The first run plugin picker no longer sets the default layout and themes to Remove. They always stay on + ## 26.11.0 ### Fixed diff --git a/src/backend/plugins/onboarding.ts b/src/backend/plugins/onboarding.ts index 5859d5b21..c277b895c 100644 --- a/src/backend/plugins/onboarding.ts +++ b/src/backend/plugins/onboarding.ts @@ -5,7 +5,7 @@ import { pluginLogger } from "../utils/logger.js"; import { getPluginRuntime } from "./index.js"; -import { onboardingDefaults } from "./bundled-index.js"; +import { isDefaultLookPlugin, onboardingDefaults } from "./bundled-index.js"; import { isLinkedDesktop, serialized, @@ -99,6 +99,11 @@ export async function offerPluginSetup(fresh: boolean): Promise { await settings.set(PLUGIN_SETUP_OFFERED_KEY, "1"); } +// The shipped default look always stays on, so the picker never offers it. +function inPicker(plugin: { id: string; source: string }): boolean { + return !(plugin.source === "bundled" && isDefaultLookPlugin(plugin.id)); +} + function choicePlugins(): ChoicePlugin[] { return getPluginRuntime() .loader.list() @@ -118,6 +123,7 @@ export async function describeOnboardingPlugins(): Promise ); const plugins = getPluginRuntime() .loader.list() + .filter(inPicker) .map((plugin): OnboardingPluginInfo => { const defaults = plugin.source === "bundled" @@ -158,7 +164,12 @@ export function applyOnboardingChoices( ): Promise { return serialized(async () => { const plugins = choicePlugins(); - const installed = new Set(plugins.map((plugin) => plugin.id)); + const installed = new Set( + getPluginRuntime() + .loader.list() + .filter(inPicker) + .map((plugin) => plugin.id), + ); const wanted: Record = {}; for (const [id, choice] of Object.entries(choices)) { if (installed.has(id)) wanted[id] = choice; diff --git a/src/backend/tests/plugins/onboarding.test.ts b/src/backend/tests/plugins/onboarding.test.ts index ca8eea2af..8f00b4438 100644 --- a/src/backend/tests/plugins/onboarding.test.ts +++ b/src/backend/tests/plugins/onboarding.test.ts @@ -197,6 +197,13 @@ describe("describeOnboardingPlugins", () => { }); expect(byId.extra).toMatchObject({ recommended: true, consent: true }); }); + + it("leaves out the default look", async () => { + writeIndex({ extra: { defaultLook: true } }); + await chain(); + const list = await onboarding.describeOnboardingPlugins(); + expect(list.plugins.map((p) => p.id).sort()).toEqual(["addon", "base"]); + }); }); describe("applyOnboardingChoices", () => { @@ -263,6 +270,22 @@ describe("applyOnboardingChoices", () => { expect(db.settings.get(onboarding.PLUGIN_SETUP_PENDING_KEY)).toBe("1"); }); + it("never turns off or removes the default look", async () => { + writeIndex({ extra: { defaultLook: true } }); + const loader = await chain(); + const result = await onboarding.applyOnboardingChoices({ + extra: "remove", + base: "remove", + addon: "remove", + }); + expect(result.failed).toEqual([]); + expect(result.removed).toEqual(["addon", "base"]); + expect(loader.get("extra")?.state).toBe("active"); + + await onboarding.applyOnboardingChoices({ extra: "disabled" }); + expect(loader.get("extra")?.state).toBe("active"); + }); + it("ignores ids that are not installed", async () => { await chain(); const result = await onboarding.applyOnboardingChoices({