Redirect if disabled list is empty

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
pull/8824/head
John Molakvoæ (skjnldsv) 7 years ago
parent a2d96128be
commit 85f5ae9264
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
  1. 591
      settings/js/main.js
  2. 15
      settings/src/components/userList.vue
  3. 9
      settings/src/store/index.js
  4. 2
      settings/src/views/Users.vue

File diff suppressed because one or more lines are too long

@ -139,8 +139,14 @@ export default {
return this.$store.getters.getServerData;
},
filteredUsers() {
if (this.route.hash === '#group_disabled') {
return this.users.filter(user => user.enabled !== true);
if (this.$route.hash === '#group_disabled') {
let disabledUsers = this.users.filter(user => user.enabled !== true);
if (disabledUsers.length===0 && this.$refs.infiniteLoading && this.$refs.infiniteLoading.isComplete) {
// disabled group is empty, redirection to all users
window.location.hash = '#group_everyone';
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
}
return disabledUsers;
}
return this.users.filter(user => user.enabled === true);
},
@ -169,12 +175,9 @@ export default {
usersLimit() {
return this.$store.getters.getUsersLimit;
},
route() {
return this.$store.getters.getRoute;
},
// get selected hash
selectedGroup() {
let hash = this.route.hash;
let hash = this.$route.hash;
if (typeof hash === 'string' && hash.length > 0) {
// we have a valid hash: groupXXXX
// group_XXXX are reserved groups

@ -13,12 +13,6 @@ const mutations = {
}
};
const getters = {
getRoute(state) {
return state.route;
}
};
export default new Vuex.Store({
modules: {
users,
@ -26,6 +20,5 @@ export default new Vuex.Store({
},
strict: debug,
mutations,
getters
mutations
});

@ -142,7 +142,7 @@ export default {
});
// Set current group as active
let activeGroup = groups.findIndex(group => group.href === this.route.hash);
let activeGroup = groups.findIndex(group => group.href === this.$route.hash);
if (activeGroup >= 0) {
groups[activeGroup].classes.push('active');
} else {

Loading…
Cancel
Save