diff --git a/__tests__/actions/fileAction.spec.ts b/__tests__/actions/fileAction.spec.ts index a6eafa278..9c7c59335 100644 --- a/__tests__/actions/fileAction.spec.ts +++ b/__tests__/actions/fileAction.spec.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { Node } from '../../lib/node/index.ts' +import type { Folder, Node } from '../../lib/node/index.ts' import type { View } from '../../lib/navigation/view.ts' import { beforeEach, describe, expect, test, vi } from 'vitest' @@ -248,8 +248,8 @@ describe('FileActions creation', () => { expect(action.displayName([], {} as unknown as View)).toBe('Test') expect(action.title?.([], {} as unknown as View)).toBe('Test title') expect(action.iconSvgInline([], {} as unknown as View)).toBe('') - await expect(action.exec({} as unknown as Node, {} as unknown as View, '/')).resolves.toBe(true) - await expect(action.execBatch?.([], {} as unknown as View, '/')).resolves.toStrictEqual([true]) + await expect(action.exec({} as unknown as Node, {} as unknown as View, {} as unknown as Folder, [])).resolves.toBe(true) + await expect(action.execBatch?.([], {} as unknown as View, {} as unknown as Folder, [])).resolves.toStrictEqual([true]) expect(action.enabled?.([], {} as unknown as View)).toBe(true) expect(action.order).toBe(100) expect(action.parent).toBe('123') diff --git a/lib/actions/fileAction.ts b/lib/actions/fileAction.ts index a47ab5d0e..32f6ef304 100644 --- a/lib/actions/fileAction.ts +++ b/lib/actions/fileAction.ts @@ -7,6 +7,7 @@ import type { Node } from '../node/node.ts' import type { View } from '../navigation/view.ts' import logger from '../utils/logger.ts' +import { Folder } from '../node/folder.ts' export enum DefaultType { DEFAULT = 'default', @@ -62,14 +63,14 @@ export interface FileActionData { * false otherwise and null if the action is silent/undefined. * @throws Error if the action failed */ - exec: (file: Node, view: View, dir: string) => Promise, + exec: (file: Node, view: View, folder: Folder, contents: Node[]) => Promise, /** * Function executed on multiple files action * @return true if the action was executed successfully, * false otherwise and null if the action is silent/undefined. * @throws Error if the action failed */ - execBatch?: (files: Node[], view: View, dir: string) => Promise<(boolean|null)[]> + execBatch?: (files: Node[], view: View, folder: Folder, contents: Node[]) => Promise<(boolean|null)[]> /** This action order in the list */ order?: number