diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-26 01:42:31 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-21 01:05:52 +0200 |
commit | 4ebea3db3a6e3ec72502b283f1dfbe842d75dbf0 (patch) | |
tree | 7d66730fa947a6bc24beda9b3bc071600c4742d4 /apps/files/src/actions | |
parent | 39780506f0b4b171ba67eeb967a0b80f0dc62d0f (diff) | |
download | nextcloud-server-4ebea3db3a6e3ec72502b283f1dfbe842d75dbf0.tar.gz nextcloud-server-4ebea3db3a6e3ec72502b283f1dfbe842d75dbf0.zip |
fix(files): Provide file actions from list entry to make it reactive
This fixes non reactive default action text of the name component.
Also use download action as default action so that only one place
is needed to define how to download a file.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src/actions')
-rw-r--r-- | apps/files/src/actions/downloadAction.spec.ts | 4 | ||||
-rw-r--r-- | apps/files/src/actions/downloadAction.ts | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/apps/files/src/actions/downloadAction.spec.ts b/apps/files/src/actions/downloadAction.spec.ts index bc9c87c0718..56ad3882d21 100644 --- a/apps/files/src/actions/downloadAction.spec.ts +++ b/apps/files/src/actions/downloadAction.spec.ts @@ -21,7 +21,7 @@ */ import { action } from './downloadAction' import { expect } from '@jest/globals' -import { File, Folder, Permission, View, FileAction } from '@nextcloud/files' +import { File, Folder, Permission, View, FileAction, DefaultType } from '@nextcloud/files' const view = { id: 'files', @@ -34,7 +34,7 @@ describe('Download action conditions tests', () => { expect(action.id).toBe('download') expect(action.displayName([], view)).toBe('Download') expect(action.iconSvgInline([], view)).toBe('<svg>SvgMock</svg>') - expect(action.default).toBeUndefined() + expect(action.default).toBe(DefaultType.DEFAULT) expect(action.order).toBe(30) }) }) diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts index de2fa081166..03686cd4243 100644 --- a/apps/files/src/actions/downloadAction.ts +++ b/apps/files/src/actions/downloadAction.ts @@ -20,7 +20,7 @@ * */ import { generateUrl } from '@nextcloud/router' -import { FileAction, Permission, Node, FileType, View } from '@nextcloud/files' +import { FileAction, Permission, Node, FileType, View, DefaultType } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import ArrowDownSvg from '@mdi/svg/svg/arrow-down.svg?raw' @@ -60,6 +60,8 @@ const isDownloadable = function(node: Node) { export const action = new FileAction({ id: 'download', + default: DefaultType.DEFAULT, + displayName: () => t('files', 'Download'), iconSvgInline: () => ArrowDownSvg, |