Skip to content

Commit 6341c2e

Browse files
fix(web): old links to moved settings sections and Appearance or Source control rows redirect too
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 00041ac commit 6341c2e

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

‎apps/web/src/components/settings/settingsSearch.test.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,13 @@ describe("movedSettingsPath", () => {
293293
expect(movedSettingsPath("/settings/general", "text-generation-model")).toBe(
294294
"/settings/threads",
295295
);
296-
expect(movedSettingsPath("/settings/connections", "authorized-clients")).toBeNull();
296+
expect(movedSettingsPath("/settings/connections", "authorized-clients")).toBe(
297+
"/settings/access",
298+
);
299+
expect(movedSettingsPath("/settings/source-control", "worktree-branch-naming")).toBe(
300+
"/settings/worktrees",
301+
);
302+
expect(movedSettingsPath("/settings/appearance", "diff-color-scheme")).toBe("/settings/diffs");
297303
expect(movedSettingsPath("/settings/connections", "network-access")).toBe("/settings/access");
298304
expect(movedSettingsPath("/settings/storage", "storage-worktrees")).toBe("/settings/worktrees");
299305
expect(movedSettingsPath("/settings/storage", "")).toBe("/settings/maintenance");
@@ -304,5 +310,7 @@ describe("movedSettingsPath", () => {
304310
it("leaves current pages alone", () => {
305311
expect(movedSettingsPath("/settings/general", "time-format")).toBeNull();
306312
expect(movedSettingsPath("/settings/projects", "project-defaults")).toBeNull();
313+
expect(movedSettingsPath("/settings/connections", "remote-environments")).toBeNull();
314+
expect(movedSettingsPath("/settings/appearance", "theme")).toBeNull();
307315
});
308316
});

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,9 +1143,18 @@ const RENAMED_SETTINGS_PATHS: Readonly<Record<string, SettingsPath>> = {
11431143
};
11441144
const SPLIT_SETTINGS_PATHS: ReadonlySet<string> = new Set([
11451145
"/settings/general",
1146+
"/settings/appearance",
1147+
"/settings/source-control",
11461148
"/settings/connections",
11471149
...Object.keys(RENAMED_SETTINGS_PATHS),
11481150
]);
1151+
// Section anchors that moved but are not search results themselves.
1152+
const MOVED_SECTION_ANCHORS: Readonly<Record<string, SettingsPath>> = {
1153+
"authorized-clients": "/settings/access",
1154+
"legacy-features": "/settings/labs",
1155+
"text-generation": "/settings/threads",
1156+
about: "/settings/about",
1157+
};
11491158

11501159
/** Where an old settings link now lives. Its anchor finds the page its row moved to. */
11511160
export function movedSettingsPath(pathname: string, hash: string): SettingsPath | null {
@@ -1154,7 +1163,8 @@ export function movedSettingsPath(pathname: string, hash: string): SettingsPath
11541163
const anchored = hash
11551164
? (items.find((item) => item.id === hash) ?? items.find((item) => item.targetId === hash))
11561165
: undefined;
1157-
const to = anchored?.to ?? RENAMED_SETTINGS_PATHS[pathname] ?? null;
1166+
const to =
1167+
anchored?.to ?? MOVED_SECTION_ANCHORS[hash] ?? RENAMED_SETTINGS_PATHS[pathname] ?? null;
11581168
return to === pathname ? null : to;
11591169
}
11601170

0 commit comments

Comments
 (0)