mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
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:
commit
84bd79d5c4
3 changed files with 13 additions and 6 deletions
|
|
@ -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
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue