Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sidebar for spaces on 'Shared via link'-page #9023

Merged
merged 1 commit into from May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-spaces-sidebar-shared-via-link
@@ -0,0 +1,6 @@
Bugfix: Sidebar for spaces on "Shared via link"-page

The sidebar for spaces on the "Shared via link"-page has been fixed which acted like the space was a folder resource before.

https://github.com/owncloud/web/issues/9020
https://github.com/owncloud/web/pull/9023
Expand Up @@ -540,7 +540,7 @@ export default defineComponent({
path = `/${resource.name}`
}

const lastLinkId = this.outgoingLinks.length === 1 ? this.outgoingLinks[0].id : undefined
let lastLinkId = this.outgoingLinks.length === 1 ? this.outgoingLinks[0].id : undefined
const loadIndicators = this.outgoingLinks.filter((l) => !l.indirect).length === 1

try {
Expand All @@ -550,6 +550,10 @@ export default defineComponent({
})

if (lastLinkId && isLocationSharesActive(this.$router, 'files-shares-via-link')) {
if (this.resourceIsSpace) {
// spaces need their actual id instead of their share id to be removed from the file list
lastLinkId = this.resource.id.toString()
}
this.REMOVE_FILES([{ id: lastLinkId }])
}
} catch (e) {
Expand Down
5 changes: 4 additions & 1 deletion packages/web-app-files/src/components/SideBar/SideBar.vue
Expand Up @@ -226,11 +226,14 @@ export default defineComponent({

// shared resources look different, hence we need to fetch the actual resource here
try {
const shareResource = await (clientService.webdav as WebDAV).getFileInfo(props.space, {
let shareResource = await (clientService.webdav as WebDAV).getFileInfo(props.space, {
path: unref(highlightedFile).path
})
shareResource.share = unref(highlightedFile).share
shareResource.status = unref(highlightedFile).status
if (unref(highlightedFileIsSpace)) {
shareResource = { ...shareResource, ...unref(highlightedFile) }
}
loadedResource.value = shareResource
} catch (error) {
loadedResource.value = resource
Expand Down
8 changes: 7 additions & 1 deletion packages/web-app-files/src/fileSideBars.ts
Expand Up @@ -139,7 +139,7 @@ const panelGenerators: (({
return !!(!multipleSelection && !rootFolder && resource && resource.type !== 'space')
}
}),
({ multipleSelection, resource, user }) => ({
({ multipleSelection, resource, router, user }) => ({
app: 'space-actions',
icon: 'slideshow-3',
title: $gettext('Actions'),
Expand All @@ -151,6 +151,12 @@ const panelGenerators: (({
if (resource?.type !== 'space') {
return false
}
if (
!isLocationSpacesActive(router, 'files-spaces-projects') &&
!isLocationSpacesActive(router, 'files-spaces-generic')
) {
return false
}
return !![
...resource.spaceRoles[spaceRoleManager.name],
...resource.spaceRoles[spaceRoleEditor.name]
Expand Down