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

Redirect to spaces overview if space get's disabled #7334

Merged
merged 7 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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-no-redirect-after-disabling-space
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: No redirect after disabling space

We've fixed a bug where the user was not redirected to the spaces overview after disabling the space
inside the space view.

https://github.com/owncloud/web/pull/7334
https://github.com/owncloud/web/issues/7291
4 changes: 4 additions & 0 deletions packages/web-app-files/src/mixins/spaces/actions/disable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'
import { clientService } from 'web-pkg/src/services'
import { createLocationSpaces, isLocationSpacesActive } from '../../../router'

export default {
computed: {
Expand Down Expand Up @@ -76,6 +77,9 @@ export default {
this.showMessage({
title: this.$gettext('Space was disabled successfully')
})
if (isLocationSpacesActive(this.$router, 'files-spaces-project')) {
this.$router.push(createLocationSpaces('files-spaces-projects'))
}
})
.catch((error) => {
console.error(error)
Expand Down
26 changes: 23 additions & 3 deletions packages/web-app-files/src/views/spaces/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
:class="getSpaceCardAdditionalClass(space)"
>
<div class="oc-card-media-top oc-border-b">
<router-link :to="getSpaceProjectRoute(space)">
<router-link
:to="getSpaceProjectRoute(space)"
@click.native="spaceLinkClicked(space)"
>
<oc-tag
v-if="space.disabled"
class="oc-position-absolute space-disabled-indicator"
Expand All @@ -72,7 +75,11 @@
<div class="oc-flex oc-flex-between oc-flex-middle">
<div class="oc-flex oc-flex-middle">
<oc-icon class="oc-mr-s" name="layout-grid" />
<router-link class="space-name oc-text-left" :to="getSpaceProjectRoute(space)">
<router-link
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved
class="space-name oc-text-left"
:to="getSpaceProjectRoute(space)"
@click.native="spaceLinkClicked(space)"
>
<span v-text="space.name"> </span>
</router-link>
</div>
Expand Down Expand Up @@ -248,6 +255,7 @@ export default defineComponent({
...mapActions('Files/sidebar', {
openSidebarWithPanel: 'openWithPanel'
}),
...mapActions(['showMessage']),
...mapMutations('Files', [
'SET_CURRENT_FOLDER',
'LOAD_FILES',
Expand All @@ -256,7 +264,10 @@ export default defineComponent({
'SET_FILE_SELECTION'
]),

getSpaceProjectRoute({ id, name }) {
getSpaceProjectRoute({ id, name, disabled }) {
if (disabled) {
return '#'
}
return createLocationSpaces('files-spaces-project', {
params: { storageId: id, name }
})
Expand All @@ -272,6 +283,15 @@ export default defineComponent({
openSidebarSharePanel(space) {
this.SET_FILE_SELECTION([space])
this.openSidebarWithPanel('space-share-item')
},

spaceLinkClicked({ disabled }) {
if (disabled) {
this.showMessage({
title: this.$gettext('Disabled spaces cannot be entered'),
status: 'warning'
})
}
}
}
})
Expand Down