mirror of https://github.com/nextcloud/bookmarks
UI: Rollback moving folders after failure
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
parent
154cd3ce04
commit
666189a970
|
@ -130,7 +130,7 @@ export default {
|
|||
return this.$store.state.sharedFoldersById[this.folder.id] !== undefined
|
||||
},
|
||||
isEditable() {
|
||||
return this.isOwner || (!this.isOwner && (this.isDirectShare || this.permissions.canWrite))
|
||||
return this.isOwner || this.isDirectShare || this.permissions.canWrite
|
||||
},
|
||||
shares() {
|
||||
return this.$store.getters.getSharesOfFolder(this.folder.id)
|
||||
|
@ -210,8 +210,11 @@ export default {
|
|||
},
|
||||
async onDrop(e) {
|
||||
e.preventDefault()
|
||||
await this.$store.dispatch(actions.MOVE_SELECTION, this.folder.id)
|
||||
this.$store.commit(mutations.RESET_SELECTION)
|
||||
try {
|
||||
await this.$store.dispatch(actions.MOVE_SELECTION, this.folder.id)
|
||||
} finally {
|
||||
this.$store.commit(mutations.RESET_SELECTION)
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -56,8 +56,11 @@ export default {
|
|||
methods: {
|
||||
async onSubmit(folderId) {
|
||||
this.$store.commit(mutations.DISPLAY_MOVE_DIALOG, false)
|
||||
await this.$store.dispatch(actions.MOVE_SELECTION, folderId)
|
||||
this.$store.commit(mutations.RESET_SELECTION)
|
||||
try {
|
||||
await this.$store.dispatch(actions.MOVE_SELECTION, folderId)
|
||||
} finally {
|
||||
this.$store.commit(mutations.RESET_SELECTION)
|
||||
}
|
||||
},
|
||||
onClose() {
|
||||
this.$store.commit(mutations.DISPLAY_MOVE_DIALOG, false)
|
||||
|
|
|
@ -785,7 +785,13 @@ export default {
|
|||
commit(mutations.MOVE_FOLDER, { folder: folder.id, target: folderId })
|
||||
const oldParent = folder.parent_folder
|
||||
folder.parent_folder = folderId
|
||||
await dispatch(actions.SAVE_FOLDER, folder.id) // reloads children order for new parent
|
||||
try {
|
||||
await dispatch(actions.SAVE_FOLDER, folder.id) // reloads children order for new parent
|
||||
} catch (err) {
|
||||
commit(mutations.MOVE_FOLDER, { folder: folder.id, target: oldParent })
|
||||
folder.parent_folder = oldParent
|
||||
throw err
|
||||
}
|
||||
dispatch(
|
||||
actions.LOAD_FOLDER_CHILDREN_ORDER,
|
||||
oldParent
|
||||
|
|
Loading…
Reference in New Issue