Skip to content

Commit

Permalink
Spaces fixes (#7576)
Browse files Browse the repository at this point in the history
  • Loading branch information
kulmann authored Sep 2, 2022
1 parent 045015a commit 2bd695b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 28 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-redirect-space-access-removal
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
}
})
Expand Down
5 changes: 4 additions & 1 deletion packages/web-app-files/src/mixins/spaces/actions/disable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/web-app-files/src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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) => {
Expand Down

0 comments on commit 2bd695b

Please sign in to comment.