Skip to content

Commit 5423909

Browse files
authored
Merge pull request #1392 from nextcloud-libraries/fix/missing-view-actions-contents
2 parents a5b01fc + 248e0f2 commit 5423909

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

__tests__/actions/fileListAction.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ describe('FileListActions init', () => {
4040
const testAction = mockAction('test')
4141

4242
expect(testAction.id).toBe('test')
43-
expect(testAction.displayName({ view, folder })).toBe('Test')
44-
expect(testAction.iconSvgInline!({ view, folder })).toBe('<svg></svg>')
43+
expect(testAction.displayName({ view, folder, contents: [] })).toBe('Test')
44+
expect(testAction.iconSvgInline!({ view, folder, contents: [] })).toBe('<svg></svg>')
4545

4646
registerFileListAction(testAction)
4747
expect(actions).toHaveLength(1)
@@ -158,10 +158,10 @@ describe('FileListAction creation', () => {
158158
})
159159

160160
expect(testAction.id).toBe('test')
161-
expect(testAction.displayName({ view, folder })).toBe('Test')
162-
expect(testAction.iconSvgInline!({ view, folder })).toBe('<svg></svg>')
161+
expect(testAction.displayName({ view, folder, contents: [] })).toBe('Test')
162+
expect(testAction.iconSvgInline!({ view, folder, contents: [] })).toBe('<svg></svg>')
163163
expect(testAction.order).toBe(0)
164-
expect(testAction.enabled?.({ view, folder })).toBe(true)
165-
await expect(testAction.exec({ view, folder, nodes: [], content: [] })).resolves.toBe(undefined)
164+
expect(testAction.enabled?.({ view, folder, contents: [] })).toBe(true)
165+
await expect(testAction.exec({ view, folder, contents: [] })).resolves.toBe(undefined)
166166
})
167167
})

lib/actions/fileListAction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import type { ActionContext, ViewActionContext } from '../types.ts'
5+
import type { ViewActionContext } from '../types.ts'
66

77
import logger from '../utils/logger.ts'
88

@@ -30,7 +30,7 @@ interface FileListActionData {
3030
* false otherwise and null if the action is silent/undefined.
3131
* @throws Error if the action failed
3232
*/
33-
exec: (context: ActionContext) => Promise<boolean|null>,
33+
exec: (context: ViewActionContext) => Promise<boolean|null>,
3434
}
3535

3636
export class FileListAction {

lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ export type ActionContext = {
2323
export type ViewActionContext = {
2424
view: View,
2525
folder: Folder,
26+
contents: Node[],
2627
}

0 commit comments

Comments
 (0)