Skip to content

Commit d01247a

Browse files
susnuxbackportbot[bot]
authored andcommitted
fix(files): also enable delete action if trashbin is disabled
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent f5b7089 commit d01247a

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

apps/files/src/actions/deleteAction.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import type { FilesTrashbinConfigState } from '../../../files_trashbin/src/fileListActions/emptyTrashAction.ts'
6-
7-
import { loadState } from '@nextcloud/initial-state'
8-
import { Permission, Node, View, FileAction } from '@nextcloud/files'
95
import { showInfo } from '@nextcloud/dialogs'
6+
import { Permission, Node, View, FileAction } from '@nextcloud/files'
7+
import { loadState } from '@nextcloud/initial-state'
108
import { translate as t } from '@nextcloud/l10n'
119
import PQueue from 'p-queue'
1210

1311
import CloseSvg from '@mdi/svg/svg/close.svg?raw'
1412
import NetworkOffSvg from '@mdi/svg/svg/network-off.svg?raw'
1513
import TrashCanSvg from '@mdi/svg/svg/trash-can.svg?raw'
1614

15+
import { TRASHBIN_VIEW_ID } from '../../../files_trashbin/src/files_views/trashbinView.ts'
16+
import { askConfirmation, canDisconnectOnly, canUnshareOnly, deleteNode, displayName, isTrashbinEnabled } from './deleteUtils.ts'
1717
import logger from '../logger.ts'
18-
import { askConfirmation, canDisconnectOnly, canUnshareOnly, deleteNode, displayName, isTrashbinEnabled } from './deleteUtils'
1918

2019
const queue = new PQueue({ concurrency: 5 })
2120

@@ -36,10 +35,12 @@ export const action = new FileAction({
3635
return TrashCanSvg
3736
},
3837

39-
enabled(nodes: Node[]) {
40-
const config = loadState<FilesTrashbinConfigState>('files_trashbin', 'config')
41-
if (!config.allow_delete) {
42-
return false
38+
enabled(nodes: Node[], view: View): boolean {
39+
if (view.id === TRASHBIN_VIEW_ID) {
40+
const config = loadState('files_trashbin', 'config', { allow_delete: true })
41+
if (config.allow_delete === false) {
42+
return false
43+
}
4344
}
4445

4546
return nodes.length > 0 && nodes

0 commit comments

Comments
 (0)