summaryrefslogtreecommitdiffstats
path: root/settings/src
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-11 09:57:13 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-16 09:50:24 +0200
commit549940ddb9643a57a0900aa002b49276e5d20d9b (patch)
tree956eddc3e1f521bc25aa8c2fd6ff8e2e81a6793d /settings/src
parenta62c796f0709dacc332b7d9328e3f6ab151991f3 (diff)
downloadnextcloud-server-549940ddb9643a57a0900aa002b49276e5d20d9b.tar.gz
nextcloud-server-549940ddb9643a57a0900aa002b49276e5d20d9b.zip
Fixed root url detection, new tests, default new user group to current
opened group and user removal update fix Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src')
-rw-r--r--settings/src/components/userList.vue29
-rw-r--r--settings/src/components/userList/userRow.vue10
-rw-r--r--settings/src/router.js2
-rw-r--r--settings/src/store/users.js4
4 files changed, 34 insertions, 11 deletions
diff --git a/settings/src/components/userList.vue b/settings/src/components/userList.vue
index 18d3609a163..7ef95a314b5 100644
--- a/settings/src/components/userList.vue
+++ b/settings/src/components/userList.vue
@@ -144,12 +144,19 @@ export default {
if (!this.settings.canChangePassword) {
OC.Notification.showTemporary(t('settings', 'Password change is disabled because the master key is disabled'));
}
+
/**
* Init default language from server data. The use of this.settings
- * requires a computed variable,vwhich break the v-model binding of the form,
- * this is a much easier solution than getter and setter
+ * requires a computed variable, which break the v-model binding of the form,
+ * this is a much easier solution than getter and setter on a computed var
*/
Vue.set(this.newUser.language, 'code', this.settings.defaultLanguage);
+
+ /**
+ * In case the user directly loaded the user list within a group
+ * the watch won't be triggered. We need to initialize it.
+ */
+ this.setNewUserDefaultGroup(this.$route.params.selectedGroup);
},
computed: {
settings() {
@@ -212,6 +219,7 @@ export default {
selectedGroup: function (val, old) {
this.$store.commit('resetUsers');
this.$refs.infiniteLoading.$emit('$InfiniteLoading:reset');
+ this.setNewUserDefaultGroup(val);
}
},
methods: {
@@ -241,8 +249,9 @@ export default {
this.$store.dispatch('getUsers', {
offset: this.usersOffset,
limit: this.usersLimit,
- group: this.selectedGroup !== 'disabled' ? this.selectedGroup : ''})
- .then((response) => {response?$state.loaded():$state.complete()});
+ group: this.selectedGroup !== 'disabled' ? this.selectedGroup : ''
+ })
+ .then((response) => { response ? $state.loaded() : $state.complete() });
},
resetForm() {
@@ -261,6 +270,18 @@ export default {
quota: this.newUser.quota.id,
language: this.newUser.language.code,
}).then(() => this.resetForm());
+ },
+ setNewUserDefaultGroup(value) {
+ if (value && value.length > 0) {
+ // setting new user default group to the current selected one
+ let currentGroup = this.groups.find(group => group.id === value);
+ if (currentGroup) {
+ this.newUser.groups = [currentGroup];
+ return;
+ }
+ }
+ // fallback, empty selected group
+ this.newUser.groups = [];
}
}
}
diff --git a/settings/src/components/userList/userRow.vue b/settings/src/components/userList/userRow.vue
index e6edc5e4f6a..78c20122bc0 100644
--- a/settings/src/components/userList/userRow.vue
+++ b/settings/src/components/userList/userRow.vue
@@ -9,7 +9,7 @@
<form class="displayName" :class="{'icon-loading-small': loading.displayName}" v-on:submit.prevent="updateDisplayName">
<input :id="'displayName'+user.id+rand" type="text"
:disabled="loading.displayName||loading.all"
- :value="user.displayname"
+ :value="user.displayname" ref="displayName"
autocomplete="new-password" autocorrect="off" autocapitalize="off" spellcheck="false" />
<input type="submit" class="icon-confirm" value="" />
</form>
@@ -353,7 +353,13 @@ export default {
let userid = this.user.id;
let gid = group.id;
return this.$store.dispatch('removeUserGroup', {userid, gid})
- .then(() => this.loading.groups = false);
+ .then(() => {
+ this.loading.groups = false
+ // remove user from current list if current list is the removed group
+ if (this.$route.params.selectedGroup === gid) {
+ this.$store.commit('deleteUser', userid);
+ }
+ });
},
/**
diff --git a/settings/src/router.js b/settings/src/router.js
index 32893b188bb..7eedb359b69 100644
--- a/settings/src/router.js
+++ b/settings/src/router.js
@@ -17,7 +17,7 @@ export default new Router({
mode: 'history',
// if index.php is in the url AND we got this far, then it's working:
// let's keep using index.php in the url
- base: window.location.pathname.indexOf('index.php') > 0 ? '/index.php/' : '/',
+ base: OC.generateUrl(''),
routes: [
{
path: '/:index(index.php/)?settings/users',
diff --git a/settings/src/store/users.js b/settings/src/store/users.js
index 0e0632fff31..052a2918390 100644
--- a/settings/src/store/users.js
+++ b/settings/src/store/users.js
@@ -57,8 +57,6 @@ const mutations = {
}
},
addUserGroup(state, { userid, gid }) {
- // this should not be needed as it would means the user contains a group
- // the server database doesn't have.
let group = state.groups.find(groupSearch => groupSearch.id == gid);
if (group) {
group.usercount++; // increase count
@@ -68,8 +66,6 @@ const mutations = {
state.groups = orderGroups(state.groups, state.orderBy);
},
removeUserGroup(state, { userid, gid }) {
- // this should not be needed as it would means the user contains a group
- // the server database doesn't have.
let group = state.groups.find(groupSearch => groupSearch.id == gid);
if (group) {
group.usercount--; // lower count