Skip to content

Commit

Permalink
Merge pull request #10357 from owncloud/fix-opening-files-external-app
Browse files Browse the repository at this point in the history
fix: opening files via external apps
  • Loading branch information
JammingBen authored Jan 18, 2024
2 parents 10266f6 + 82f8e22 commit 5f1f681
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion packages/web-app-external/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { stringify } from 'qs'
import { Resource, SpaceResource } from '@ownclouders/web-client'
import { join } from 'path'
import { AppListSchema } from './schemas'
import { useGettext } from 'vue3-gettext'

const appInfo = {
name: 'External',
Expand All @@ -38,6 +39,7 @@ export default defineWebApplication({
const appsStore = useAppsStore()
const { makeRequest } = useRequest()
const clientService = useClientService()
const { $gettext } = useGettext()

return {
appInfo,
Expand All @@ -63,7 +65,9 @@ export default defineWebApplication({
appId: 'external',
data: {
extension: mimeType.ext,
label: mimeType.name,
label: $gettext('Open in %{app}', { app: provider.name }),
icon: provider.icon,
name: provider.name,
mimeType: mimeType.mime_type,
routeName: 'external-apps',
hasPriority: mimeType.default_application === provider.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ export default defineComponent({
},
ownedByCurrentUser() {
return (
this.resource.ownerId === this.user.onPremisesSamAccountName ||
this.resource.owner?.[0].username === this.user.onPremisesSamAccountName ||
this.resource.shareOwner === this.user.onPremisesSamAccountName
this.resource.ownerId === this.user?.onPremisesSamAccountName ||
this.resource.owner?.[0].username === this.user?.onPremisesSamAccountName ||
this.resource.shareOwner === this.user?.onPremisesSamAccountName
)
},
shareIndicators() {
Expand Down
2 changes: 2 additions & 0 deletions packages/web-pkg/src/apps/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export interface ApplicationFileExtension {
}) => Promise<Resource>
hasPriority?: boolean
label?: string
name?: string
icon?: string
mimeType?: string
newFileMenu?: { menuTitle: () => string }
routeName?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const useFileActions = ({ store }: { store?: Store<any> } = {}) => {
}
return $gettext('Open in %{app}', { app: appInfo.name }, true)
},
icon: appInfo.icon,
icon: fileExtension.icon || appInfo.icon,
...(appInfo.iconFillType && {
iconFillType: appInfo.iconFillType
}),
Expand Down Expand Up @@ -170,6 +170,7 @@ export const useFileActions = ({ store }: { store?: Store<any> } = {}) => {
query: {
...(shareId && { shareId }),
...(resource.fileId && configStore.options.routing.idBased && { fileId: resource.fileId }),
...(appFileExtension.app === 'external' && { app: appFileExtension.name }),
...routeToContextQuery(unref(router.currentRoute))
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/web-pkg/src/composables/piniaStores/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export const useAppsStore = defineStore('apps', () => {
mimeType: data.mimeType,
routeName: data.routeName,
newFileMenu: data.newFileMenu,
icon: data.icon,
name: data.name,
hasPriority:
data.hasPriority ||
unref(externalAppConfig)?.[appId]?.priorityExtensions?.includes(data.extension) ||
Expand Down

0 comments on commit 5f1f681

Please sign in to comment.