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: backport recent master fixes to stable-11.0 #11948

Merged
merged 3 commits into from
Nov 25, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Export request ID when delete fails

We've fixed a bug where the request ID was not exposed to the error message when a delete operation failed.

https://github.com/owncloud/web/pull/11951
https://github.com/owncloud/web/issues/11925
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 navigation issues with the preview app on the Shared with me page.

https://github.com/owncloud/web/issues/11883
https://github.com/owncloud/web/pull/11947
20 changes: 18 additions & 2 deletions packages/web-app-preview/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import {
Ref
} from 'vue'
import { RouteLocationRaw } from 'vue-router'
import { Resource } from '@ownclouders/web-client'
import { isShareSpaceResource, Resource } from '@ownclouders/web-client'
import {
AppFileHandlingResult,
AppFolderHandlingResult,
Expand Down Expand Up @@ -141,6 +141,7 @@ export default defineComponent({
const contextRouteQuery = useRouteQuery('contextRouteQuery') as unknown as Ref<
Record<string, string>
>

const { isFileTypeAudio, isFileTypeImage, isFileTypeVideo } = useFileTypes()
const previewService = usePreviewService()
const { dimensions } = usePreviewDimensions()
Expand All @@ -164,13 +165,16 @@ export default defineComponent({
return (unref(contextRouteQuery)['sort-dir'] as SortDir) ?? SortDir.Asc
})

const fileIdQuery = useRouteQuery('fileId')
const fileId = computed(() => queryItemAsString(unref(fileIdQuery)))

const filteredFiles = computed(() => {
if (!props.activeFiles) {
return []
}

const files = props.activeFiles.filter((file) => {
return mimeTypes.includes(file.mimeType?.toLowerCase())
return mimeTypes.includes(file.mimeType?.toLowerCase()) && file.canDownload()
})

return sortHelper(files, [{ name: unref(sortBy) }], unref(sortBy), unref(sortDir))
Expand Down Expand Up @@ -288,6 +292,7 @@ export default defineComponent({
return {
...useImageControls(),
...useFullScreenMode(),
fileId,
activeFilteredFile,
activeIndex,
activeMediaFileCached,
Expand Down Expand Up @@ -333,6 +338,17 @@ export default defineComponent({
methods: {
setActiveFile(driveAliasAndItem: string) {
for (let i = 0; i < this.filteredFiles.length; i++) {
if (isShareSpaceResource(unref(this.currentFileContext.space))) {
// with share space resources, we don't have an underlying space, so match the file id
if (this.filteredFiles[i].remoteItemId === this.fileId) {
this.activeIndex = i
return
}

this.activeIndex = 0
continue
}

if (
unref(this.currentFileContext.space)?.getDriveAliasAndItem(this.filteredFiles[i]) ===
driveAliasAndItem
Expand Down
27 changes: 18 additions & 9 deletions packages/web-app-preview/tests/unit/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,64 @@ const activeFiles = [
id: '1',
name: 'bear.png',
mimeType: 'image/png',
path: 'personal/admin/bear.png'
path: 'personal/admin/bear.png',
canDownload: () => true
},
{
id: '2',
name: 'elephant.png',
mimeType: 'image/png',
path: 'personal/admin/elephant.png'
path: 'personal/admin/elephant.png',
canDownload: () => true
},
{
id: '3',
name: 'wale_sounds.flac',
mimeType: 'audio/flac',
path: 'personal/admin/wale_sounds.flac'
path: 'personal/admin/wale_sounds.flac',
canDownload: () => true
},
{
id: '4',
name: 'lonely_sloth_very_sad.gif',
mimeType: 'image/gif',
path: 'personal/admin/lonely_sloth_very_sad.gif'
path: 'personal/admin/lonely_sloth_very_sad.gif',
canDownload: () => true
},
{
id: '5',
name: 'tiger_eats_plants.mp4',
mimeType: 'video/mp4',
path: 'personal/admin/tiger_eats_plants.mp4'
path: 'personal/admin/tiger_eats_plants.mp4',
canDownload: () => true
},
{
id: '6',
name: 'happy_hippo.gif',
mimeType: 'image/gif',
path: 'personal/admin/happy_hippo.gif'
path: 'personal/admin/happy_hippo.gif',
canDownload: () => true
},
{
id: '7',
name: 'sleeping_dog.gif',
mimeType: 'image/gif',
path: 'personal/admin/sleeping_dog.gif'
path: 'personal/admin/sleeping_dog.gif',
canDownload: () => true
},
{
id: '8',
name: 'cat_murr_murr.gif',
mimeType: 'image/gif',
path: 'personal/admin/cat_murr_murr.gif'
path: 'personal/admin/cat_murr_murr.gif',
canDownload: () => true
},
{
id: '9',
name: 'labrador.gif',
mimeType: 'image/gif',
path: 'personal/admin/labrador.gif'
path: 'personal/admin/labrador.gif',
canDownload: () => true
}
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export const useFileActions = () => {
return {
name: routeName,
params: {
driveAliasAndItem: space.getDriveAliasAndItem(resource),
driveAliasAndItem: space?.getDriveAliasAndItem(resource),
filePath: resource.path,
fileId: resource.fileId,
mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export const useFileActionsDeleteResources = () => {
})
}

messageStore.showErrorMessage({ title, errors: [new Error()] })
messageStore.showErrorMessage({ title, errors: [error] })
})

// user hasn't navigated to another location meanwhile
Expand Down