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
chore(desktop): drop the unused mime argument of "Open with"
Elian Doran655051eb7b2a
diff --git a/apps/client/src/components/root_command_executor.ts b/apps/client/src/components/root_command_executor.tsindex 073ab1e6ab..0c92b83cb0 100644--- a/apps/client/src/components/root_command_executor.ts+++ b/apps/client/src/components/root_command_executor.ts@@ -64,7 +64,7 @@ export default class RootCommandExecutor extends Component {openNoteCustomCommand({ ntxId }: CommandListenerData<"openNoteCustom">) {const note = appContext.tabManager.getCommandContext(ntxId)?.note;if (note) {- openService.openNoteCustom(note.noteId, note.mime);+ openService.openNoteCustom(note.noteId);}}diff --git a/apps/client/src/services/attachment_actions.spec.ts b/apps/client/src/services/attachment_actions.spec.tsindex 7a6fd1d09f..9ccbec336b 100644--- a/apps/client/src/services/attachment_actions.spec.ts+++ b/apps/client/src/services/attachment_actions.spec.ts@@ -108,7 +108,7 @@ describe("getAttachmentActionGroups", () => {await actions["compress-image-menu"].run();expect(mocks.open.openAttachmentExternally).toHaveBeenCalledWith("att1", "image/png");- expect(mocks.open.openAttachmentCustom).toHaveBeenCalledWith("att1", "image/png");+ expect(mocks.open.openAttachmentCustom).toHaveBeenCalledWith("att1");expect(mocks.open.downloadAttachment).toHaveBeenCalledWith("att1");expect(mocks.triggerCommand).toHaveBeenCalledWith("showOcrTextDialog", {textUrl: "ocr/attachments/att1/text",diff --git a/apps/client/src/services/attachment_actions.ts b/apps/client/src/services/attachment_actions.tsindex 2e076d9bb6..84200d5a82 100644--- a/apps/client/src/services/attachment_actions.ts+++ b/apps/client/src/services/attachment_actions.ts@@ -49,7 +49,7 @@ function getViewActions(attachment: FAttachment,copyReference: AttachmentActionOptions["copyReference"]): AttachmentAction[] {- const { attachmentId, mime } = attachment;+ const { attachmentId } = attachment;return [getOpenExternallyAction(attachment),@@ -60,7 +60,7 @@ function getViewActions(disabledReason: utils.isElectron()? undefined: t("attachments_actions.open_custom_client_only"),- run: () => open.openAttachmentCustom(attachmentId, mime)+ run: () => open.openAttachmentCustom(attachmentId)},getDownloadAction(attachment),...(copyReference ? [ {diff --git a/apps/client/src/services/open.spec.ts b/apps/client/src/services/open.spec.tsindex bc995b308a..b564848615 100644--- a/apps/client/src/services/open.spec.ts+++ b/apps/client/src/services/open.spec.ts@@ -159,7 +159,7 @@ describe("open service", () => {describe("openCustom", () => {it("does nothing in the browser (no electronApi)", async () => {server.post = vi.fn(async () => ({ tmpFilePath: "/tmp/x" })) as typeof server.post;- await open.openNoteCustom("n1", "image/png");+ await open.openNoteCustom("n1");expect(server.post).not.toHaveBeenCalled();});@@ -167,7 +167,7 @@ describe("open service", () => {const shell = installElectronApi();vi.spyOn(utils, "isMac").mockReturnValue(true);server.post = vi.fn(async () => ({ tmpFilePath: "/tmp/x" })) as typeof server.post;- await open.openAttachmentCustom("a1", "image/png");+ await open.openAttachmentCustom("a1");expect(server.post).not.toHaveBeenCalled();expect(shell.openCustom).not.toHaveBeenCalled();});@@ -176,7 +176,7 @@ describe("open service", () => {const shell = installElectronApi();const toastSpy = vi.spyOn(toast, "showError").mockImplementation(() => {});server.post = vi.fn(async () => ({ tmpFilePath: "/tmp/file.png" })) as typeof server.post;- await open.openNoteCustom("n2", "image/png");+ await open.openNoteCustom("n2");expect(server.post).toHaveBeenCalledWith("notes/n2/save-to-tmp-dir");expect(shell.openCustom).toHaveBeenCalledWith("/tmp/file.png");expect(toastSpy).not.toHaveBeenCalled();@@ -187,7 +187,7 @@ describe("open service", () => {shell.openCustom.mockResolvedValue(false);const toastSpy = vi.spyOn(toast, "showError").mockImplementation(() => {});server.post = vi.fn(async () => ({ tmpFilePath: "/tmp/file.png" })) as typeof server.post;- await open.openAttachmentCustom("a2", "image/png");+ await open.openAttachmentCustom("a2");expect(shell.openCustom).toHaveBeenCalledWith("/tmp/file.png");expect(toastSpy).toHaveBeenCalledOnce();});diff --git a/apps/client/src/services/open.ts b/apps/client/src/services/open.tsindex dd6a500b1e..754044a11a 100644--- a/apps/client/src/services/open.ts+++ b/apps/client/src/services/open.ts@@ -59,7 +59,7 @@ function downloadAttachment(attachmentId: string) {download(url);}-async function openCustom(type: string, entityId: string, mime: string) {+async function openCustom(type: string, entityId: string) {checkType(type);if (!window.electronApi || utils.isMac()) {return;@@ -71,8 +71,8 @@ async function openCustom(type: string, entityId: string, mime: string) {}}-const openNoteCustom = async (noteId: string, mime: string) => await openCustom("notes", noteId, mime);-const openAttachmentCustom = async (attachmentId: string, mime: string) => await openCustom("attachments", attachmentId, mime);+const openNoteCustom = async (noteId: string) => await openCustom("notes", noteId);+const openAttachmentCustom = async (attachmentId: string) => await openCustom("attachments", attachmentId);function downloadRevision(noteId: string, revisionId: string) {const url = getUrlForDownload(`api/revisions/${revisionId}/download`);