mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
fix(files): "New folder" menu entry requires read permission
This will disable "New folder" menu entry for file-drop shares. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
11fdf4e2a7
commit
c9dc0afcb1
2 changed files with 8 additions and 6 deletions
|
|
@ -13,6 +13,7 @@
|
|||
:open.sync="openedMenu">
|
||||
<NcActionButton v-for="action in enabledActions"
|
||||
:key="action.id"
|
||||
:aria-label="action.displayName(nodes, currentView) + ' ' + t('files', '(selected)') /** TRANSLATORS: Selected like 'selected files and folders' */"
|
||||
:class="'files-list__row-actions-batch-' + action.id"
|
||||
@click="onActionClick(action)">
|
||||
<template #icon>
|
||||
|
|
@ -40,6 +41,7 @@ import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
|
|||
import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js'
|
||||
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
|
||||
|
||||
import { useRouteParameters } from '../composables/useRouteParameters.ts'
|
||||
import { useActionsMenuStore } from '../store/actionsmenu.ts'
|
||||
import { useFilesStore } from '../store/files.ts'
|
||||
import { useSelectionStore } from '../store/selection.ts'
|
||||
|
|
@ -78,7 +80,11 @@ export default defineComponent({
|
|||
const actionsMenuStore = useActionsMenuStore()
|
||||
const filesStore = useFilesStore()
|
||||
const selectionStore = useSelectionStore()
|
||||
const { directory } = useRouteParameters()
|
||||
|
||||
return {
|
||||
directory,
|
||||
|
||||
actionsMenuStore,
|
||||
filesStore,
|
||||
selectionStore,
|
||||
|
|
@ -92,10 +98,6 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
computed: {
|
||||
dir() {
|
||||
// Remove any trailing slash but leave root slash
|
||||
return (this.$route?.query?.dir || '/').replace(/^(.+)\/$/, '$1')
|
||||
},
|
||||
enabledActions() {
|
||||
return actions
|
||||
.filter(action => action.execBatch)
|
||||
|
|
@ -157,7 +159,7 @@ export default defineComponent({
|
|||
})
|
||||
|
||||
// Dispatch action execution
|
||||
const results = await action.execBatch(this.nodes, this.currentView, this.dir)
|
||||
const results = await action.execBatch(this.nodes, this.currentView, this.directory)
|
||||
|
||||
// Check if all actions returned null
|
||||
if (!results.some(result => result !== null)) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ const createNewFolder = async (root: Folder, name: string): Promise<createFolder
|
|||
export const entry = {
|
||||
id: 'newFolder',
|
||||
displayName: t('files', 'New folder'),
|
||||
enabled: (context: Folder) => (context.permissions & Permission.CREATE) !== 0,
|
||||
enabled: (context: Folder) => Boolean(context.permissions & Permission.CREATE) && Boolean(context.permissions & Permission.READ),
|
||||
iconSvgInline: FolderPlusSvg,
|
||||
order: 0,
|
||||
async handler(context: Folder, content: Node[]) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue