aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src/views/FileReferencePickerElement.vue
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src/views/FileReferencePickerElement.vue')
-rw-r--r--apps/files/src/views/FileReferencePickerElement.vue45
1 files changed, 14 insertions, 31 deletions
diff --git a/apps/files/src/views/FileReferencePickerElement.vue b/apps/files/src/views/FileReferencePickerElement.vue
index a6c1522d010..b4d4bc54f14 100644
--- a/apps/files/src/views/FileReferencePickerElement.vue
+++ b/apps/files/src/views/FileReferencePickerElement.vue
@@ -1,23 +1,7 @@
<!--
- - @copyright Copyright (c) 2023 Julius Härtl <jus@bitgrid.net>
- -
- - @author Julius Härtl <jus@bitgrid.net>
- -
- - @license GNU AGPL version 3 or any later version
- -
- - This program is free software: you can redistribute it and/or modify
- - it under the terms of the GNU Affero General Public License as
- - published by the Free Software Foundation, either version 3 of the
- - License, or (at your option) any later version.
- -
- - This program is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU Affero General Public License for more details.
- -
- - You should have received a copy of the GNU Affero General Public License
- - along with this program. If not, see <http://www.gnu.org/licenses/>.
- -->
+ - SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ - SPDX-License-Identifier: AGPL-3.0-or-later
+-->
<template>
<div :id="containerId">
@@ -55,7 +39,7 @@ export default defineComponent({
},
filepickerOptions() {
return {
- allowPickDirectory: false,
+ allowPickDirectory: true,
buttons: this.buttonFactory,
container: `#${this.containerId}`,
multiselect: false,
@@ -69,18 +53,17 @@ export default defineComponent({
buttonFactory(selected: NcNode[]): IFilePickerButton[] {
const buttons = [] as IFilePickerButton[]
if (selected.length === 0) {
- buttons.push({
- label: t('files', 'Choose file'),
- type: 'tertiary' as never,
- callback: this.onClose,
- })
- } else {
- buttons.push({
- label: t('files', 'Choose {file}', { file: selected[0].basename }),
- type: 'primary',
- callback: this.onClose,
- })
+ return []
+ }
+ const node = selected.at(0)
+ if (node.path === '/') {
+ return [] // Do not allow selecting the users root folder
}
+ buttons.push({
+ label: t('files', 'Choose {file}', { file: node.displayname }),
+ type: 'primary',
+ callback: this.onClose,
+ })
return buttons
},