diff --git a/packages/web-app-files/src/mixins/actions/restore.ts b/packages/web-app-files/src/mixins/actions/restore.ts index 7f41f77af19..95c818567c5 100644 --- a/packages/web-app-files/src/mixins/actions/restore.ts +++ b/packages/web-app-files/src/mixins/actions/restore.ts @@ -14,7 +14,6 @@ export default { ...mapState(['user']), ...mapState('runtime/spaces', ['spaces']), ...mapGetters(['configuration', 'capabilities']), - ...mapGetters('runtime/auth', ['accessToken']), $_restore_items() { return [ @@ -111,10 +110,8 @@ export default { // Load quota if (this.capabilities?.spaces?.enabled) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) const driveId = isLocationTrashActive(this.$router, 'files-trash-spaces-project') ? this.$route.params.storageId : this.spaces.find((s) => s.driveType === 'personal').id diff --git a/packages/web-app-files/src/mixins/spaces/actions/delete.js b/packages/web-app-files/src/mixins/spaces/actions/delete.js index adc8250d22b..d93c579c9f9 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/delete.js +++ b/packages/web-app-files/src/mixins/spaces/actions/delete.js @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services' export default { computed: { ...mapGetters(['configuration']), - ...mapGetters('runtime/auth', ['accessToken']), ...mapState(['user']), $_delete_items() { @@ -61,10 +60,8 @@ export default { }, $_delete_deleteSpace(id) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) return graphClient.drives .deleteDrive(id, '', { headers: { diff --git a/packages/web-app-files/src/mixins/spaces/actions/disable.js b/packages/web-app-files/src/mixins/spaces/actions/disable.js index 6f79bb827b0..d2b7dc270cc 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/disable.js +++ b/packages/web-app-files/src/mixins/spaces/actions/disable.js @@ -5,7 +5,6 @@ import { createLocationSpaces, isLocationSpacesActive } from '../../../router' export default { computed: { ...mapGetters(['configuration']), - ...mapGetters('runtime/auth', ['accessToken']), ...mapState(['user']), $_disable_items() { @@ -61,10 +60,8 @@ export default { }, $_disable_disableSpace(id) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) return graphClient.drives .deleteDrive(id) .then(() => { diff --git a/packages/web-app-files/src/mixins/spaces/actions/editDescription.js b/packages/web-app-files/src/mixins/spaces/actions/editDescription.js index 860b42b3bca..50e7d8fd0df 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/editDescription.js +++ b/packages/web-app-files/src/mixins/spaces/actions/editDescription.js @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services' export default { computed: { ...mapGetters(['configuration']), - ...mapGetters('runtime/auth', ['accessToken']), $_editDescription_items() { return [ @@ -61,10 +60,8 @@ export default { }, $_editDescription_editDescriptionSpace(id, description) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) return graphClient.drives .updateDrive(id, { description }, {}) .then(() => { diff --git a/packages/web-app-files/src/mixins/spaces/actions/rename.js b/packages/web-app-files/src/mixins/spaces/actions/rename.js index 295ae5614f7..67ed7ce6a65 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/rename.js +++ b/packages/web-app-files/src/mixins/spaces/actions/rename.js @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services' export default { computed: { ...mapGetters(['configuration', 'user']), - ...mapGetters('runtime/auth', ['accessToken']), $_rename_items() { return [ @@ -68,10 +67,8 @@ export default { }, $_rename_renameSpace(id, name) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) return graphClient.drives .updateDrive(id, { name }, {}) .then(() => { diff --git a/packages/web-app-files/src/mixins/spaces/actions/restore.ts b/packages/web-app-files/src/mixins/spaces/actions/restore.ts index 485c93c01b3..60950dbdaac 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/restore.ts +++ b/packages/web-app-files/src/mixins/spaces/actions/restore.ts @@ -4,7 +4,6 @@ import { clientService } from 'web-pkg/src/services' export default { computed: { ...mapGetters(['configuration']), - ...mapGetters('runtime/auth', ['accessToken']), ...mapState(['user']), $_restore_items() { @@ -60,10 +59,8 @@ export default { }, $_restore_restoreSpace(id) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) return graphClient.drives .updateDrive( id, diff --git a/packages/web-app-files/src/mixins/spaces/actions/setImage.js b/packages/web-app-files/src/mixins/spaces/actions/setImage.js index f192d953c3c..3b892672cc6 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/setImage.js +++ b/packages/web-app-files/src/mixins/spaces/actions/setImage.js @@ -12,7 +12,6 @@ export default { }, computed: { ...mapGetters(['configuration']), - ...mapGetters('runtime/auth', ['accessToken']), ...mapState(['user']), $_setSpaceImage_items() { return [ @@ -57,10 +56,8 @@ export default { ...mapMutations('runtime/spaces', ['UPDATE_SPACE_FIELD']), ...mapActions(['showMessage']), async $_setSpaceImage_trigger({ resources }) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) const storageId = this.$route.params.storageId const sourcePath = resources[0].webDavPath const destinationPath = `/spaces/${storageId}/.space/${resources[0].name}` diff --git a/packages/web-app-files/src/mixins/spaces/actions/uploadImage.js b/packages/web-app-files/src/mixins/spaces/actions/uploadImage.js index 99269a7b27a..3c2d7f2817c 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/uploadImage.js +++ b/packages/web-app-files/src/mixins/spaces/actions/uploadImage.js @@ -11,7 +11,6 @@ export default { }, computed: { ...mapState('Files', ['currentFolder']), - ...mapGetters('runtime/auth', ['accessToken']), ...mapGetters(['configuration']), $_uploadImage_items() { return [ @@ -47,10 +46,8 @@ export default { this.$refs.spaceImageInput.click() }, $_uploadImage_uploadImageSpace(ev) { - const graphClient = clientService.graphAuthenticated( - this.configuration.server, - this.accessToken - ) + const accessToken = this.$store.getters['runtime/auth/accessToken'] + const graphClient = clientService.graphAuthenticated(this.configuration.server, accessToken) const file = ev.currentTarget.files[0] if (!file) { diff --git a/packages/web-app-files/tests/unit/components/AppBar/AppBar.spec.js b/packages/web-app-files/tests/unit/components/AppBar/AppBar.spec.js index 41c4675ab9e..a02856c7817 100644 --- a/packages/web-app-files/tests/unit/components/AppBar/AppBar.spec.js +++ b/packages/web-app-files/tests/unit/components/AppBar/AppBar.spec.js @@ -150,6 +150,14 @@ function createStore(state = { selected: [] }) { mutations: { SET_HIDDEN_FILES_VISIBILITY: jest.fn(), SET_FILE_EXTENSIONS_VISIBILITY: jest.fn() + }, + modules: { + sidebar: { + namespaced: true, + state: { + closed: false + } + } } } } diff --git a/packages/web-app-files/tests/unit/components/SideBar/FileInfo.spec.js b/packages/web-app-files/tests/unit/components/SideBar/FileInfo.spec.js index 2f087b5e60a..ecfe56b8a1d 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/FileInfo.spec.js +++ b/packages/web-app-files/tests/unit/components/SideBar/FileInfo.spec.js @@ -53,6 +53,14 @@ function createWrapper(testResource, tooltipStub, routeName, privateLinksEnabled highlightedFile: function () { return testResource } + }, + modules: { + sidebar: { + namespaced: true, + state: { + activePanel: null + } + } } } } diff --git a/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/__snapshots__/ListItem.spec.js.snap b/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/__snapshots__/ListItem.spec.js.snap index 07c025b1c18..500a7d31e81 100644 --- a/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/__snapshots__/ListItem.spec.js.snap +++ b/packages/web-app-files/tests/unit/components/SideBar/Shares/Collaborators/__snapshots__/ListItem.spec.js.snap @@ -24,7 +24,7 @@ exports[`Collaborator ListItem component share inheritance indicators show when - + diff --git a/packages/web-runtime/src/components/Avatar.vue b/packages/web-runtime/src/components/Avatar.vue index 6ef44795051..7bc0db9fbcc 100644 --- a/packages/web-runtime/src/components/Avatar.vue +++ b/packages/web-runtime/src/components/Avatar.vue @@ -61,8 +61,7 @@ export default { } }, computed: { - ...mapGetters(['capabilities', 'configuration']), - ...mapGetters('runtime/auth', ['accessToken']) + ...mapGetters(['capabilities', 'configuration']) }, watch: { userid: function (userid) { @@ -87,10 +86,11 @@ export default { this.loading = false return } + const accessToken = this.$store.getters['runtime/auth/accessToken'] const headers = new Headers() const instance = this.configuration.server || window.location.origin const url = instance + 'remote.php/dav/avatars/' + userid + '/128.png' - headers.append('Authorization', 'Bearer ' + this.accessToken) + headers.append('Authorization', 'Bearer ' + accessToken) headers.append('X-Requested-With', 'XMLHttpRequest') fetch(url, { headers }) .then((response) => { diff --git a/tests/unit/stubs/index.js b/tests/unit/stubs/index.js index 875872516e7..6d90f7b6de7 100644 --- a/tests/unit/stubs/index.js +++ b/tests/unit/stubs/index.js @@ -17,5 +17,6 @@ export default { 'router-link': true, 'portal-target': true, 'oc-progress': true, - 'oc-status-indicators': true + 'oc-status-indicators': true, + 'oc-info-drop': true }