Merge pull request #48512 from nextcloud/fix/pick-folder-smart-picker

fix(files): Fix folders not being selectable in the smart picker
pull/48519/head
Pytal 2 months ago committed by GitHub
commit 7cc1b2a102
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      apps/files/src/views/FileReferencePickerElement.vue
  2. 4
      dist/files-reference-files.js
  3. 2
      dist/files-reference-files.js.map

@ -39,7 +39,7 @@ export default defineComponent({
},
filepickerOptions() {
return {
allowPickDirectory: false,
allowPickDirectory: true,
buttons: this.buttonFactory,
container: `#${this.containerId}`,
multiselect: false,
@ -53,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
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save