diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-12 16:03:10 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-08-13 10:31:07 +0200 |
commit | 58acf4c608e188a393b5d2d2021128f6c98b6f18 (patch) | |
tree | edef9152375c3d24cee36281fee426e0fbb017c2 /apps | |
parent | 21db61817467169d225af1e4a96bb37f9feaf70e (diff) | |
download | nextcloud-server-58acf4c608e188a393b5d2d2021128f6c98b6f18.tar.gz nextcloud-server-58acf4c608e188a393b5d2d2021128f6c98b6f18.zip |
fix(files): Add messages when "new folder" fails or gets cancelled
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/newMenu/newFolder.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/files/src/newMenu/newFolder.ts b/apps/files/src/newMenu/newFolder.ts index feab032270c..ee9c20dd668 100644 --- a/apps/files/src/newMenu/newFolder.ts +++ b/apps/files/src/newMenu/newFolder.ts @@ -8,7 +8,7 @@ import { basename } from 'path' import { emit } from '@nextcloud/event-bus' import { getCurrentUser } from '@nextcloud/auth' import { Permission, Folder } from '@nextcloud/files' -import { showSuccess } from '@nextcloud/dialogs' +import { showError, showInfo, showSuccess } from '@nextcloud/dialogs' import { translate as t } from '@nextcloud/l10n' import axios from '@nextcloud/axios' @@ -47,7 +47,11 @@ export const entry = { order: 0, async handler(context: Folder, content: Node[]) { const name = await newNodeName(t('files', 'New folder'), content) - if (name !== null) { + if (name === null) { + showInfo(t('files', 'Creating new folder cancelled')) + return + } + try { const { fileid, source } = await createNewFolder(context, name.trim()) // Create the folder in the store @@ -74,9 +78,12 @@ export const entry = { // Navigate to the new folder window.OCP.Files.Router.goToRoute( null, // use default route - { view: 'files', fileid: folder.fileid }, + { view: 'files', fileid: String(fileid) }, { dir: context.path }, ) + } catch (error) { + logger.error('Creating new folder failed', { error }) + showError('Creating new folder failed') } }, } as Entry |