Skip to content

Commit

Permalink
fix(files): Adjust files list for sharing permissions on public shares
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Jun 11, 2024
1 parent 52a5346 commit fe796c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
12 changes: 10 additions & 2 deletions apps/files/src/FilesApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
-->
<template>
<NcContent app-name="files">
<Navigation />
<FilesList />
<Navigation v-if="!isPublic" />
<FilesList :is-public="isPublic" />
</NcContent>
</template>

Expand All @@ -16,6 +16,7 @@ import NcContent from '@nextcloud/vue/dist/Components/NcContent.js'
import Navigation from './views/Navigation.vue'
import FilesList from './views/FilesList.vue'
import { loadState } from '@nextcloud/initial-state'
export default defineComponent({
name: 'FilesApp',
Expand All @@ -25,5 +26,12 @@ export default defineComponent({
FilesList,
Navigation,
},
setup() {
const isPublic = loadState('files_sharing', 'isPublic', false)
return {
isPublic,
}
},
})
</script>
16 changes: 14 additions & 2 deletions apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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="dir" @reload="fetchContent">
<template #actions>
Expand Down Expand Up @@ -179,6 +179,13 @@ export default defineComponent({
filesSortingMixin,
],
props: {
isPublic: {
type: Boolean,
default: false,
},
},
setup() {
const filesStore = useFilesStore()
const pathsStore = usePathsStore()
Expand Down Expand Up @@ -431,7 +438,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
},
},
Expand Down Expand Up @@ -698,6 +705,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
Expand Down

0 comments on commit fe796c0

Please sign in to comment.