aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/actions/deleteAction.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/actions/deleteAction.ts')
-rw-r--r--apps/files/src/actions/deleteAction.ts15
1 files changed, 5 insertions, 10 deletions
diff --git a/apps/files/src/actions/deleteAction.ts b/apps/files/src/actions/deleteAction.ts
index edcc615a34b..fa4fdfe8cdc 100644
--- a/apps/files/src/actions/deleteAction.ts
+++ b/apps/files/src/actions/deleteAction.ts
@@ -2,18 +2,16 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-import { showInfo } from '@nextcloud/dialogs'
import { Permission, Node, View, FileAction } from '@nextcloud/files'
import { loadState } from '@nextcloud/initial-state'
-import { translate as t } from '@nextcloud/l10n'
import PQueue from 'p-queue'
import CloseSvg from '@mdi/svg/svg/close.svg?raw'
import NetworkOffSvg from '@mdi/svg/svg/network-off.svg?raw'
-import TrashCanSvg from '@mdi/svg/svg/trash-can.svg?raw'
+import TrashCanSvg from '@mdi/svg/svg/trash-can-outline.svg?raw'
import { TRASHBIN_VIEW_ID } from '../../../files_trashbin/src/files_views/trashbinView.ts'
-import { askConfirmation, canDisconnectOnly, canUnshareOnly, deleteNode, displayName, isTrashbinEnabled } from './deleteUtils.ts'
+import { askConfirmation, canDisconnectOnly, canUnshareOnly, deleteNode, displayName, shouldAskForConfirmation } from './deleteUtils.ts'
import logger from '../logger.ts'
const queue = new PQueue({ concurrency: 5 })
@@ -58,14 +56,12 @@ export const action = new FileAction({
const callStack = new Error().stack || ''
const isCalledFromEventListener = callStack.toLocaleLowerCase().includes('keydown')
- // If trashbin is disabled, we need to ask for confirmation
- if (!isTrashbinEnabled() || isCalledFromEventListener) {
+ if (shouldAskForConfirmation() || isCalledFromEventListener) {
confirm = await askConfirmation([node], view)
}
// If the user cancels the deletion, we don't want to do anything
if (confirm === false) {
- showInfo(t('files', 'Deletion cancelled'))
return null
}
@@ -81,8 +77,7 @@ export const action = new FileAction({
async execBatch(nodes: Node[], view: View): Promise<(boolean | null)[]> {
let confirm = true
- // If trashbin is disabled, we need to ask for confirmation
- if (!isTrashbinEnabled()) {
+ if (shouldAskForConfirmation()) {
confirm = await askConfirmation(nodes, view)
} else if (nodes.length >= 5 && !canUnshareOnly(nodes) && !canDisconnectOnly(nodes)) {
confirm = await askConfirmation(nodes, view)
@@ -90,7 +85,6 @@ export const action = new FileAction({
// If the user cancels the deletion, we don't want to do anything
if (confirm === false) {
- showInfo(t('files', 'Deletion cancelled'))
return Promise.all(nodes.map(() => null))
}
@@ -114,5 +108,6 @@ export const action = new FileAction({
return Promise.all(promises)
},
+ destructive: true,
order: 100,
})