Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(script api): open Security settings in the options modal, not a tab
Elian Doran9b78a47549cb
diff --git a/apps/client/src/services/frontend_script_api.spec.ts b/apps/client/src/services/frontend_script_api.spec.tsindex 6ce0080e87..5ec6360d88 100644--- a/apps/client/src/services/frontend_script_api.spec.ts+++ b/apps/client/src/services/frontend_script_api.spec.ts@@ -192,6 +192,11 @@ describe("runOnBackend / __runOnBackendInner", () => {// No server round-trip, and a single deduplicated toast (fixed id) is shown instead of a 500.expect(post).not.toHaveBeenCalled();expect(showPersistent).toHaveBeenCalledWith(expect.objectContaining({ id: "backend-scripting-disabled" }));++ // The toast's action opens Security settings in the options modal, not a hoisted tab.+ const triggerCommand = vi.spyOn(appContext, "triggerCommand").mockReturnValue(undefined as never);+ showPersistent.mock.calls[0][0].buttons?.[0].onClick({ dismissToast: vi.fn() });+ expect(triggerCommand).toHaveBeenCalledWith("showOptions", { section: "_optionsSecurity" });});it("serializes a sync function, posts it, waits for sync and returns the result", async () => {diff --git a/apps/client/src/services/frontend_script_api.ts b/apps/client/src/services/frontend_script_api.tsindex b58de1d278..9b55a5e62b 100644--- a/apps/client/src/services/frontend_script_api.ts+++ b/apps/client/src/services/frontend_script_api.ts@@ -830,7 +830,7 @@ function showBackendScriptingDisabledToast() {{text: t("frontend_script_api.backend_scripting_disabled_open_settings"),onClick: ({ dismissToast }) => {- appContext.tabManager.openInNewTab("_optionsSecurity", "_hidden", true);+ appContext.triggerCommand("showOptions", { section: "_optionsSecurity" });dismissToast();}}