diff --git a/changelog/unreleased/bugfix-redirect-space-access-removal b/changelog/unreleased/bugfix-redirect-space-access-removal new file mode 100644 index 00000000000..2c3e122e9bd --- /dev/null +++ b/changelog/unreleased/bugfix-redirect-space-access-removal @@ -0,0 +1,6 @@ +Bugfix: Redirect after removing self from space members + +When a user removes themselves from the members of a project space we now properly redirect to the project spaces overviewe page instead of showing an error message. + +https://github.com/owncloud/web/issues/7534 +https://github.com/owncloud/web/pull/7576 diff --git a/packages/web-app-files/src/components/SideBar/Shares/SpaceMembers.vue b/packages/web-app-files/src/components/SideBar/Shares/SpaceMembers.vue index dbae693b591..18283e20db8 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/SpaceMembers.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/SpaceMembers.vue @@ -119,33 +119,34 @@ export default defineComponent({ this.createModal(modal) }, - $_ocCollaborators_deleteShare(share) { - this.deleteShare({ - client: this.$client, - graphClient: this.graphClient, - share: share, - path: this.highlightedFile.path - }) - .then(() => { - this.hideModal() - this.showMessage({ - title: this.$gettext('Share was removed successfully') - }) - // current user was removed from the share. - if (share.collaborator.name === this.user.id) { - if (isLocationSpacesActive(this.$router, 'files-spaces-projects')) { - return this.$router.go() - } - return this.$router.push(createLocationSpaces('files-spaces-projects')) - } + async $_ocCollaborators_deleteShare(share) { + try { + await this.deleteShare({ + client: this.$client, + graphClient: this.graphClient, + share: share, + path: this.highlightedFile.path, + reloadResource: false + }) + this.showMessage({ + title: this.$gettext('Share was removed successfully') }) - .catch((error) => { - console.error(error) - this.showMessage({ - title: this.$gettext('Failed to remove share'), - status: 'danger' - }) + // current user was removed from the share. + if (share.collaborator.name === this.user.id) { + if (isLocationSpacesActive(this.$router, 'files-spaces-projects')) { + return this.$router.go() + } + return this.$router.push(createLocationSpaces('files-spaces-projects')) + } + } catch (error) { + console.error(error) + this.showMessage({ + title: this.$gettext('Failed to remove share'), + status: 'danger' }) + } finally { + this.hideModal() + } } } }) 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 e1e084763c2..f3157176163 100644 --- a/packages/web-app-files/src/mixins/spaces/actions/disable.js +++ b/packages/web-app-files/src/mixins/spaces/actions/disable.js @@ -74,8 +74,11 @@ export default { this.showMessage({ title: this.$gettext('Space was disabled successfully') }) + if (isLocationSpacesActive(this.$router, 'files-spaces-projects')) { + return + } if (isLocationSpacesActive(this.$router, 'files-spaces-project')) { - this.$router.push(createLocationSpaces('files-spaces-projects')) + return this.$router.push(createLocationSpaces('files-spaces-projects')) } }) .catch((error) => { diff --git a/packages/web-app-files/src/store/actions.ts b/packages/web-app-files/src/store/actions.ts index 6dc02ae8f20..0aa7f390b15 100644 --- a/packages/web-app-files/src/store/actions.ts +++ b/packages/web-app-files/src/store/actions.ts @@ -542,7 +542,7 @@ export default { ) }) }, - deleteShare(context, { client, graphClient, share, path, storageId }) { + deleteShare(context, { client, graphClient, share, path, storageId, reloadResource = true }) { const additionalParams: any = {} if (share.shareType === ShareTypes.space.value) { additionalParams.shareWith = share.collaborator.name @@ -554,7 +554,7 @@ export default { if (share.shareType !== ShareTypes.space.value) { context.dispatch('updateCurrentFileShareTypes') context.dispatch('loadIndicators', { client, currentFolder: path, storageId }) - } else { + } else if (reloadResource) { context.commit('CURRENT_FILE_OUTGOING_SHARES_LOADING', true) return graphClient.drives.getDrive(share.id).then((response) => {