Skip to content

Commit

Permalink
fix(files): Keep 'back'-button for not found directories or if user c…
Browse files Browse the repository at this point in the history
…an not upload

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed May 16, 2024
1 parent b16ca5b commit bd4a107
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,21 @@
:name="currentView?.emptyTitle || t('files', 'No files in here')"
:description="currentView?.emptyCaption || t('files', 'Upload some content or sync with your devices!')"
data-cy-files-content-empty>
<template #action>
<template v-if="dir !== '/'" #action>
<!-- Uploader -->
<UploadPicker v-if="dir !== '/'"
<UploadPicker v-if="currentFolder && canUpload && !isQuotaExceeded"
:content="dirContents"
:destination="currentFolder"
:multiple="true"
class="files-list__header-upload-button"
multiple
@failed="onUploadFail"
@uploaded="onUpload" />
<NcButton v-else
:aria-label="t('files', 'Go to the previous folder')"
:to="toPreviousDir"
type="primary">
{{ t('files', 'Go back') }}
</NcButton>
</template>
<template #icon>
<NcIconSvgWrapper :svg="currentView.icon" />
Expand All @@ -118,10 +124,10 @@
</template>

<script lang="ts">
import type { Route } from 'vue-router'
import type { View, ContentsWithRoot } from '@nextcloud/files'
import type { Upload } from '@nextcloud/upload'
import type { Route } from 'vue-router'
import type { UserConfig } from '../types.ts'
import type { View, ContentsWithRoot } from '@nextcloud/files'

import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { Folder, Node, Permission } from '@nextcloud/files'
Expand Down Expand Up @@ -354,6 +360,14 @@ export default defineComponent({
&& this.loading
},

/**
* Route to the previous directory.
*/
toPreviousDir(): Route {
const dir = this.dir.split('/').slice(0, -1).join('/') || '/'
return { ...this.$route, query: { dir } }
},

shareAttributes(): number[] | undefined {
if (!this.currentFolder?.attributes?.['share-types']) {
return undefined
Expand Down

0 comments on commit bd4a107

Please sign in to comment.