fix(files): Adjust files list for sharing permissions on public shares

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/45652/head
Ferdinand Thiessen 2024-06-04 01:28:22 +07:00
parent 819f5cea9b
commit 82a7a3971d
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
2 changed files with 25 additions and 4 deletions

@ -4,12 +4,13 @@
-->
<template>
<NcContent app-name="files">
<Navigation />
<FilesList />
<Navigation v-if="!isPublic" />
<FilesList :is-public="isPublic" />
</NcContent>
</template>
<script lang="ts">
import { isPublicShare } from '@nextcloud/sharing/public'
import { defineComponent } from 'vue'
import NcContent from '@nextcloud/vue/dist/Components/NcContent.js'
@ -25,5 +26,13 @@ export default defineComponent({
FilesList,
Navigation,
},
setup() {
const isPublic = isPublicShare()
return {
isPublic,
}
},
})
</script>

@ -4,7 +4,7 @@
-->
<template>
<NcAppContent :page-heading="pageHeading" data-cy-files-content>
<div class="files-list__header">
<div class="files-list__header" :class="{ 'files-list__header--public': isPublic }">
<!-- Current folder breadcrumbs -->
<BreadCrumbs :path="directory" @reload="fetchContent">
<template #actions>
@ -189,6 +189,13 @@ export default defineComponent({
filesSortingMixin,
],
props: {
isPublic: {
type: Boolean,
default: false,
},
},
setup() {
const filesStore = useFilesStore()
const filtersStore = useFiltersStore()
@ -393,7 +400,7 @@ export default defineComponent({
* Check if current folder has share permissions
*/
canShare() {
return isSharingEnabled
return isSharingEnabled && !this.isPublic
&& this.currentFolder && (this.currentFolder.permissions & Permission.SHARE) !== 0
},
@ -682,6 +689,11 @@ export default defineComponent({
margin-block: var(--app-navigation-padding, 4px);
margin-inline: calc(var(--default-clickable-area, 44px) + 2 * var(--app-navigation-padding, 4px)) var(--app-navigation-padding, 4px);
&--public {
// There is no navigation toggle on public shares
margin-inline: 0 var(--app-navigation-padding, 4px);
}
>* {
// Do not grow or shrink (horizontally)
// Only the breadcrumbs shrinks