From 44954fab0ccbd2a2c6af99b3a82d65278d0feeb0 Mon Sep 17 00:00:00 2001 From: Adib Hanna Date: Wed, 28 Oct 2026 18:11:08 -0500 Subject: [PATCH] Fix(settings): the Covers section names the Unsplash key only where it has a key row Settings, Typography, Covers described itself as "How a note's cover shows, and the Unsplash key the cover picker searches with." on every host, but the phones have no Unsplash bridge, so they show no key row and no Unsplash tab: the description promised a setting that is not there. Found walking the iPhone 1.34.0 release build. The description now follows the same check the key row uses (unsplashKeySupported): with the bridge it reads as before, without it "How a note's cover shows." Test: the Covers section's text without the Unsplash bridge leaves the key out, and with it names the key (fails on the previous text). --- .../src/components/SettingsModal.test.ts | 23 +++++++++++++++++++ .../app-core/src/components/SettingsModal.tsx | 8 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/app-core/src/components/SettingsModal.test.ts b/packages/app-core/src/components/SettingsModal.test.ts index 781f56c43..998909178 100644 --- a/packages/app-core/src/components/SettingsModal.test.ts +++ b/packages/app-core/src/components/SettingsModal.test.ts @@ -376,6 +376,29 @@ describe("SettingsModal date note directories", () => { expect(await sharesRowFound()).toBe(true); }); + it("names the Unsplash key in the Covers section only where the key row exists", async () => { + const coversDescription = async (): Promise => { + await act(async () => root.render(createElement(SettingsModal))); + const typography = [...host.querySelectorAll("button")].find( + (button) => button.textContent?.trim() === "Typography", + ); + expect(typography).toBeTruthy(); + await act(async () => typography!.click()); + return host.textContent ?? ""; + }; + // The phones' bridge has no Unsplash methods. + let text = await coversDescription(); + expect(text).toContain("How a note's cover shows."); + expect(text).not.toContain("Unsplash key the cover picker searches with"); + + await act(async () => root.render(createElement("div"))); + Object.assign(window.zen, { + getUnsplashKeyStatus: vi.fn().mockResolvedValue({ set: false, store: "system", canStore: true }), + }); + text = await coversDescription(); + expect(text).toContain("and the Unsplash key the cover picker searches with."); + }); + it("leaves the shares location out where there is no Share menu extension", async () => { await act(async () => root.render(createElement(SettingsModal))); const search = host.querySelector('input[placeholder="Search settings…"]')!; diff --git a/packages/app-core/src/components/SettingsModal.tsx b/packages/app-core/src/components/SettingsModal.tsx index 4821381e1..b113347a5 100644 --- a/packages/app-core/src/components/SettingsModal.tsx +++ b/packages/app-core/src/components/SettingsModal.tsx @@ -4005,7 +4005,13 @@ export function SettingsModal(): JSX.Element {