Properly redirect after album {delete,move,merge}.
That is, we don't redirect to the albums view, but to the current album or the parent album if the current one has been deleted.
This commit is contained in:
parent
7126354d7a
commit
5ee34c50a4
@ -256,6 +256,21 @@ album.delete = function(albumIDs) {
|
|||||||
albums.deleteByID(id)
|
albums.deleteByID(id)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
} else if (visible.album()) {
|
||||||
|
|
||||||
|
// if we deleted the current album, go to its parent
|
||||||
|
if (albumIDs.length==1 && album.json.id==albumIDs[0]) {
|
||||||
|
|
||||||
|
let id = album.getParent()
|
||||||
|
album.refresh()
|
||||||
|
lychee.goto(id)
|
||||||
|
|
||||||
|
}
|
||||||
|
// otherwise, we deleted a subalbum
|
||||||
|
else {
|
||||||
|
album.reload()
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
albums.refresh()
|
albums.refresh()
|
||||||
@ -684,12 +699,8 @@ album.merge = function(albumIDs, titles = []) {
|
|||||||
|
|
||||||
api.post('Album::merge', params, function(data) {
|
api.post('Album::merge', params, function(data) {
|
||||||
|
|
||||||
if (data!==true) {
|
if (data!==true) lychee.error(null, params, data)
|
||||||
lychee.error(null, params, data)
|
else album.reload()
|
||||||
} else {
|
|
||||||
albums.refresh()
|
|
||||||
lychee.goto()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -724,12 +735,8 @@ album.move = function(albumIDs, titles = []) {
|
|||||||
|
|
||||||
api.post('Album::move', params, function(data) {
|
api.post('Album::move', params, function(data) {
|
||||||
|
|
||||||
if (data!==true) {
|
if (data!==true) lychee.error(null, params, data)
|
||||||
lychee.error(null, params, data)
|
else album.reload()
|
||||||
} else {
|
|
||||||
albums.refresh()
|
|
||||||
lychee.goto()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -751,3 +758,22 @@ album.move = function(albumIDs, titles = []) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
album.reload = function() {
|
||||||
|
|
||||||
|
let albumID = album.getID()
|
||||||
|
|
||||||
|
album.refresh()
|
||||||
|
albums.refresh()
|
||||||
|
|
||||||
|
if (visible.album()) lychee.goto(albumID)
|
||||||
|
else lychee.goto()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
album.refresh = function() {
|
||||||
|
|
||||||
|
album.json = null
|
||||||
|
album.subjson = null
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user