Merge pull request #47181 from nextcloud/fix/new-folder-messae

fix(files): Add messages when "new folder" fails or gets cancelled
This commit is contained in:
Ferdinand Thiessen 2024-08-13 12:09:55 +02:00 committed by GitHub
commit 84bd79d5c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 13 additions and 6 deletions

View file

@ -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

4
dist/files-init.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long