Fix auto page thingy breaking

Basically, when you're on the very last page of either uploads or users
lists, and then you decide to delete all uploads/users in the list, by
default it will automatically load the latest valid page (e.g. page - 1,
or more if it has to).
Unfortunately, that behavior will get cancelled out by "Something else
is still loading" warning. This fixed that.

Bumped v1 version string and rebuilt client assets.
This commit is contained in:
Bobby Wibowo 2020-06-10 02:06:43 +07:00
parent 0851d71688
commit c1d3b9724c
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF
4 changed files with 12 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -530,14 +530,15 @@ page.getUploads = (params = {}) => {
const pages = Math.ceil(response.data.count / 25) const pages = Math.ceil(response.data.count / 25)
const files = response.data.files const files = response.data.files
if (params.pageNum && (files.length === 0)) if (params.pageNum && (files.length === 0)) {
page.updateTrigger(params.trigger)
if (params.autoPage) { if (params.autoPage) {
params.pageNum = pages - 1 params.pageNum = pages - 1
return page.getUploads(params) return page.getUploads(params)
} else { } else {
page.updateTrigger(params.trigger)
return swal('An error occurred!', `There are no more uploads to populate page ${params.pageNum + 1}.`, 'error') return swal('An error occurred!', `There are no more uploads to populate page ${params.pageNum + 1}.`, 'error')
} }
}
page.currentView = params.all ? 'uploadsAll' : 'uploads' page.currentView = params.all ? 'uploadsAll' : 'uploads'
page.cache = {} page.cache = {}
@ -1577,14 +1578,15 @@ page.getAlbums = (params = {}) => {
const pages = Math.ceil(response.data.count / 25) const pages = Math.ceil(response.data.count / 25)
const albums = response.data.albums const albums = response.data.albums
if (params.pageNum && (albums.length === 0)) if (params.pageNum && (albums.length === 0)) {
page.updateTrigger(params.trigger)
if (params.autoPage) { if (params.autoPage) {
params.pageNum = pages - 1 params.pageNum = pages - 1
return page.getAlbums(params) return page.getAlbums(params)
} else { } else {
page.updateTrigger(params.trigger)
return swal('An error occurred!', `There are no more albums to populate page ${params.pageNum + 1}.`, 'error') return swal('An error occurred!', `There are no more albums to populate page ${params.pageNum + 1}.`, 'error')
} }
}
page.currentView = params.all ? 'albumsAll' : 'albums' page.currentView = params.all ? 'albumsAll' : 'albums'
page.cache = {} page.cache = {}
@ -2241,14 +2243,15 @@ page.getUsers = (params = {}) => {
const pages = Math.ceil(response.data.count / 25) const pages = Math.ceil(response.data.count / 25)
const users = response.data.users const users = response.data.users
if (params.pageNum && (users.length === 0)) if (params.pageNum && (users.length === 0)) {
page.updateTrigger(params.trigger)
if (params.autoPage) { if (params.autoPage) {
params.pageNum = pages - 1 params.pageNum = pages - 1
return page.getUsers(params) return page.getUsers(params)
} else { } else {
page.updateTrigger(params.trigger)
return swal('An error occurred!', `There are no more users to populate page ${params.pageNum + 1}.`, 'error') return swal('An error occurred!', `There are no more users to populate page ${params.pageNum + 1}.`, 'error')
} }
}
page.currentView = 'users' page.currentView = 'users'
page.cache = {} page.cache = {}

View File

@ -1,5 +1,5 @@
{ {
"1": "1591507680", "1": "1591729432",
"2": "1589010026", "2": "1589010026",
"3": "1581416390", "3": "1581416390",
"4": "1581416390", "4": "1581416390",