Skip to content

Commit

Permalink
Merge pull request #11905 from owncloud/backport-fixes-20241114
Browse files Browse the repository at this point in the history
fix: backport recent fixes to stable-11.0
  • Loading branch information
JammingBen authored Nov 14, 2024
2 parents e12870e + bdb211e commit 27ac8a6
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: App top bar does not show location when shared file is opened

We've fixed an issue where the app top bar did not show the location when a shared file was opened.

https://github.com/owncloud/web/pull/11900
https://github.com/owncloud/web/issues/11896
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Open from app and Save As feature broken when opened via shared file

We've fixed an issue where the Open from app and Save As feature was broken when opened via a shared file.

https://github.com/owncloud/web/pull/11900
https://github.com/owncloud/web/issues/11895
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-preview-app-shared-with-me-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Preview app Shared with me page

We fixed a navigation issue with the preview app on the Shared with me page.

https://github.com/owncloud/web/issues/11883
https://github.com/owncloud/web/pull/11893
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-public-folder-reload
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Public folder reload

Reloading a folder on a public link page is no longer broken.

https://github.com/owncloud/web/pull/11904
https://github.com/owncloud/web/issues/11902
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: "Save as" / "Open" when embed delegate authentication is enabled

We've fixed the "Save as" / "Open" actions when embed delegate authentication is enabled on the server side.

https://github.com/owncloud/web/issues/11897
https://github.com/owncloud/web/pull/11899
7 changes: 6 additions & 1 deletion packages/web-pkg/src/components/AppTemplates/AppWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,12 @@ export default defineComponent({
yield addMissingDriveAliasAndItem()
}
space.value = unref(unref(currentFileContext).space)
resource.value = yield getFileInfo(currentFileContext, { signal })
resource.value = yield getFileInfo(unref(currentFileContext), { signal })
//FIXME: As soon the backend exposes oc-remote-id via webdav, remove the assignment below
if (isShareSpaceResource(unref(space))) {
unref(resource).remoteItemId = unref(space).id
}
resourcesStore.initResourceList({ currentFolder: null, resources: [unref(resource)] })
selectedResources.value = [unref(resource)]
} catch (e) {
Expand Down
36 changes: 9 additions & 27 deletions packages/web-pkg/src/components/AppTopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
id="app-top-bar-resource"
:is-thumbnail-displayed="false"
:is-extension-displayed="areFileExtensionsShown"
:path-prefix="pathPrefix"
:path-prefix="getPathPrefix(resource)"
:resource="resource"
:parent-folder-name="parentFolderName"
:parent-folder-name="getParentFolderName(resource)"
:parent-folder-link-icon-additional-attributes="
parentFolderLinkIconAdditionalAttributes
getParentFolderLinkIconAdditionalAttributes(resource)
"
:is-path-displayed="isPathDisplayed"
/>
Expand Down Expand Up @@ -99,7 +99,7 @@ import {
useResourcesStore
} from '../composables'
import ResourceListItem from './FilesList/ResourceListItem.vue'
import { Resource, isPublicSpaceResource, isShareSpaceResource } from '@ownclouders/web-client'
import { isPublicSpaceResource, Resource } from '@ownclouders/web-client'
import { Duration } from 'luxon'
export default defineComponent({
Expand Down Expand Up @@ -140,9 +140,9 @@ export default defineComponent({
emits: ['close'],
setup(props) {
const { $gettext, current: currentLanguage } = useGettext()
const { getMatchingSpace } = useGetMatchingSpace()
const resourcesStore = useResourcesStore()
const configStore = useConfigStore()
const { getMatchingSpace } = useGetMatchingSpace()
const areFileExtensionsShown = computed(() => resourcesStore.areFileExtensionsShown)
const contextMenuLabel = computed(() => $gettext('Show context menu'))
Expand All @@ -158,38 +158,20 @@ export default defineComponent({
return $gettext(`Autosave (every %{ duration })`, { duration: duration.toHuman() })
})
const { getParentFolderName, getParentFolderLinkIconAdditionalAttributes, getPathPrefix } =
useFolderLink()
const space = computed(() => getMatchingSpace(props.resource))
//FIXME: We currently have problems to display the parent folder name of a shared file, so we disabled it for now
const isPathDisplayed = computed(() => {
return !isShareSpaceResource(unref(space)) && !isPublicSpaceResource(unref(space))
})
const pathPrefix = computed(() => {
return props.resource ? getPathPrefix(props.resource) : null
})
const parentFolderName = computed(() => {
return props.resource ? getParentFolderName(props.resource) : null
})
const parentFolderLinkIconAdditionalAttributes = computed(() => {
return props.resource ? getParentFolderLinkIconAdditionalAttributes(props.resource) : null
return !isPublicSpaceResource(unref(space))
})
return {
pathPrefix,
isPathDisplayed,
contextMenuLabel,
closeButtonLabel,
parentFolderName,
parentFolderLinkIconAdditionalAttributes,
areFileExtensionsShown,
hasAutosave,
autoSaveTooltipText
autoSaveTooltipText,
isPathDisplayed,
...useFolderLink()
}
}
})
Expand Down
3 changes: 2 additions & 1 deletion packages/web-pkg/src/components/Modals/FilePickerModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default defineComponent({
iframeUrl.searchParams.append('hide-logo', 'true')
iframeUrl.searchParams.append('embed', 'true')
iframeUrl.searchParams.append('embed-target', 'file')
iframeUrl.searchParams.append('embed-delegate-authentication', 'false')
iframeUrl.searchParams.append('embed-file-types', availableFileTypes.join(','))
const onLoad = () => {
Expand Down Expand Up @@ -122,7 +123,7 @@ export default defineComponent({
</script>

<style lang="scss">
.open-with-app-modal {
.oc-modal.open-with-app-modal {
max-width: 80vw;
border: none;
overflow: hidden;
Expand Down
3 changes: 2 additions & 1 deletion packages/web-pkg/src/components/Modals/SaveAsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default defineComponent({
iframeUrl.searchParams.append('embed', 'true')
iframeUrl.searchParams.append('embed-target', 'location')
iframeUrl.searchParams.append('embed-choose-file-name', 'true')
iframeUrl.searchParams.append('embed-delegate-authentication', 'false')
iframeUrl.searchParams.append('embed-choose-file-name-suggestion', props.originalResource.name)
const onLoad = () => {
Expand Down Expand Up @@ -188,7 +189,7 @@ export default defineComponent({
</script>

<style lang="scss">
.save-as-modal {
.oc-modal.save-as-modal {
max-width: 80vw;
border: none;
overflow: hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { Ref, ref, unref, MaybeRef } from 'vue'
import { dirname } from 'path'
import { ClientService } from '../../services'
import { useAppFileHandling } from './useAppFileHandling'
import { Resource } from '@ownclouders/web-client'
import { buildIncomingShareResource, Resource } from '@ownclouders/web-client'
import { FileContext } from './types'
import { RouteLocationNormalizedLoaded } from 'vue-router'
import { useFileRouteReplace } from '../router/useFileRouteReplace'
import { DavProperty } from '@ownclouders/web-client/webdav'
import { useAuthService } from '../authContext/useAuthService'
import { isMountPointSpaceResource } from '@ownclouders/web-client'
import { useResourcesStore, useSpacesStore } from '../piniaStores'
import { useResourcesStore, useSharesStore, useSpacesStore } from '../piniaStores'
import { storeToRefs } from 'pinia'

interface AppFolderHandlingOptions {
Expand All @@ -29,22 +29,39 @@ export function useAppFolderHandling({
clientService
}: AppFolderHandlingOptions): AppFolderHandlingResult {
const isFolderLoading = ref(false)
const { webdav } = clientService
const { webdav, graphAuthenticated } = clientService
const { replaceInvalidFileRoute } = useFileRouteReplace()
const { getFileInfo } = useAppFileHandling({ clientService })
const authService = useAuthService()
const spacesStore = useSpacesStore()
const sharesStore = useSharesStore()

const resourcesStore = useResourcesStore()
const { activeResources } = storeToRefs(resourcesStore)

const loadFolderForFileContext = async (context: MaybeRef<FileContext>) => {
isFolderLoading.value = true
resourcesStore.clearResourceList()

try {
context = unref(context)
const space = unref(context.space)

if (context.routeName === 'files-shares-with-me') {
// FIXME: this is a somewhat hacky solution to load the shared with me files.
// ideally we should check if there is a current folder and if not, use the
// folder loader to load files. unfortunately, it currently lives in the files app.
const driveItems = await graphAuthenticated.driveItems.listSharedWithMe()

const resources = driveItems.map((driveItem) =>
buildIncomingShareResource({ driveItem, graphRoles: sharesStore.graphRoles })
)

resourcesStore.initResourceList({ currentFolder: null, resources })
isFolderLoading.value = false
return
}

resourcesStore.clearResourceList()
const space = unref(context.space)
const pathResource = await getFileInfo(context, {
davProperties: [DavProperty.FileId]
})
Expand Down
6 changes: 5 additions & 1 deletion packages/web-pkg/src/composables/folderLink/useFolderLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export const useFolderLink = (options: ResourceRouteResolverOptions = {}) => {
space,
path: dirname(resource.path)
})
if (isShareRoot(resource) || !parentFolderAccessible) {

//FIXME: As soon the backend exposes oc-share-root via webdav, only use isShareRoot fn
const shareRoot =
isShareRoot(resource) || (resource.id === space.id && isShareSpaceResource(space))
if (shareRoot || !parentFolderAccessible) {
return $gettext('Shared with me')
}
const parentFolder = extractParentFolderName(resource)
Expand Down
14 changes: 8 additions & 6 deletions packages/web-pkg/src/composables/piniaStores/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,14 @@ export const useResourcesStore = defineStore('resources', () => {
} else {
const { parentFolderId } = Object.values(data)[0]
const space = spacesStore.spaces.find(({ id }) => parentFolderId.startsWith(id))
data['/'] = {
id: space.id,
shareTypes: space.shareTypes,
parentFolderId: space.id,
spaceId: space.id,
path: '/'
if (space) {
data['/'] = {
id: space.id,
shareTypes: space.shareTypes,
parentFolderId: space.id,
spaceId: space.id,
path: '/'
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const useCanListVersions = () => {
if (isTrashResource(resource)) {
return false
}
return space.canListVersions({ user: userStore.user })
return space?.canListVersions({ user: userStore.user })
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('FilePickerModal', () => {
it('sets the iframe src correctly', () => {
const { wrapper } = getWrapper()
expect(wrapper.vm.iframeSrc).toEqual(
'http://localhost:3000/files-spaces-generic?hide-logo=true&embed=true&embed-target=file&embed-file-types=text%2Cmd%2Ctext%2Frtf'
'http://localhost:3000/files-spaces-generic?hide-logo=true&embed=true&embed-target=file&embed-delegate-authentication=false&embed-file-types=text%2Cmd%2Ctext%2Frtf'
)
})
it('sets the iframe title correctly', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('SaveAsModal', () => {
it('sets the iframe src correctly', () => {
const { wrapper } = getWrapper()
expect(wrapper.vm.iframeSrc).toEqual(
'http://localhost:3000/files-spaces-generic?hide-logo=true&embed=true&embed-target=location&embed-choose-file-name=true&embed-choose-file-name-suggestion=test.txt'
'http://localhost:3000/files-spaces-generic?hide-logo=true&embed=true&embed-target=location&embed-choose-file-name=true&embed-delegate-authentication=false&embed-choose-file-name-suggestion=test.txt'
)
})
it('sets the iframe title correctly', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ describe('useFolderLink', () => {
const resource = {
path: '/My share/test.txt',
remoteItemPath: '/My share',
remoteItemId: '1'
remoteItemId: '1',
storageId: '1'
} as Resource

const wrapper = createWrapper()
Expand Down

0 comments on commit 27ac8a6

Please sign in to comment.