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

External apps fixes #7166

Closed
wants to merge 4 commits into from
Closed
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
7 changes: 7 additions & 0 deletions changelog/unreleased/bugfix-external-apps
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: External apps fixes

Bug introduced in #6870. A method used to communicate with the backend was not properly added to the extension after being moved to a different location.

(bonus: app name back in the title)

https://github.com/owncloud/web/pull/7166
21 changes: 15 additions & 6 deletions packages/web-app-external/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ export default {
return this.$route.query.fileId
}
},
mounted() {
if (this.appName) {
document.title = [
this.currentFileContext.fileName,
this.appName,
this.configuration.currentTheme.general.name
]
.filter(Boolean)
.join(' - ')
}
},
async created() {
await unauthenticatedUserReady(this.$router, this.$store)

Expand Down Expand Up @@ -130,19 +141,17 @@ export default {
return
}

const data = await response.json()

if (!data.app_url || !data.method) {
if (!response.data.app_url || !response.data.method) {
this.errorMessage = this.$gettext('Error in app server response')
this.loading = false
this.loadingError = true
console.error('Error in app server response')
return
}

this.appUrl = data.app_url
this.method = data.method
if (data.form_parameters) this.formParameters = data.form_parameters
this.appUrl = response.data.app_url
this.method = response.data.method
if (response.data.form_parameters) this.formParameters = response.data.form_parameters

if (this.method === 'POST' && this.formParameters) {
this.$nextTick(() => this.$refs.subm.click())
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app-external/tests/unit/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('The app provider extension', () => {
Promise.resolve({
ok: true,
status: 200,
json: () => providerSuccessResponseGet
data: providerSuccessResponseGet
})
)

Expand All @@ -158,7 +158,7 @@ describe('The app provider extension', () => {
Promise.resolve({
ok: true,
status: 200,
json: () => providerSuccessResponsePost
data: providerSuccessResponsePost
})
)
const wrapper = createShallowMountWrapper(makeRequest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { useAppConfig, AppConfigResult } from './useAppConfig'
import { useAppFileHandling, AppFileHandlingResult } from './useAppFileHandling'
import { useAppFolderHandling, AppFolderHandlingResult } from './useAppFolderHandling'
import { useAppDocumentTitle } from './useAppDocumentTitle'
import { usePublicLinkPassword, usePublicLinkContext } from '../authContext'
import { usePublicLinkPassword, usePublicLinkContext, useRequest } from '../authContext'
import { useClientService } from '../clientService'

// TODO: this file/folder contains file/folder loading logic extracted from preview and drawio extensions
Expand Down Expand Up @@ -76,6 +76,7 @@ export function useAppDefaults(options: AppDefaultsOptions): AppDefaultsResult {
isPublicLinkContext,
publicLinkPassword
}),
...useAppFolderHandling({ clientService, store, isPublicLinkContext, publicLinkPassword })
...useAppFolderHandling({ clientService, store, isPublicLinkContext, publicLinkPassword }),
...useRequest({ clientService, store, currentRoute: unref(currentRoute) })
}
}