aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-03-11 14:48:08 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2024-03-11 16:02:40 +0100
commit78bcab1aac8b262046b5fe0a137d8286d8747737 (patch)
treec472fdd7e4a42f49e3a7fcc95b2fa7329127edfe
parentcbdadba2e3e3ef3669e319371c0b3420e5b02faa (diff)
downloadnextcloud-server-78bcab1aac8b262046b5fe0a137d8286d8747737.tar.gz
nextcloud-server-78bcab1aac8b262046b5fe0a137d8286d8747737.zip
fix(settings): Save account management settings in local storage
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r--apps/settings/src/components/Users/UserSettingsDialog.vue38
-rw-r--r--apps/settings/src/store/users.js14
2 files changed, 18 insertions, 34 deletions
diff --git a/apps/settings/src/components/Users/UserSettingsDialog.vue b/apps/settings/src/components/Users/UserSettingsDialog.vue
index e87f53cdf38..8580fe5e3fb 100644
--- a/apps/settings/src/components/Users/UserSettingsDialog.vue
+++ b/apps/settings/src/components/Users/UserSettingsDialog.vue
@@ -74,7 +74,6 @@
</template>
<script>
-import { getBuilder } from '@nextcloud/browser-storage'
import { formatFileSize, parseFileSize } from '@nextcloud/files'
import { generateUrl } from '@nextcloud/router'
@@ -103,15 +102,6 @@ export default {
},
},
- setup() {
- const localStorage = getBuilder('settings')
- .persist(true)
- .clearOnLogout(true)
- .build()
-
- return { localStorage }
- },
-
data() {
return {
selectedQuota: false,
@@ -139,37 +129,37 @@ export default {
showLanguages: {
get() {
- return this.getLocalstorage('showLanguages')
+ return this.showConfig.showLanguages
},
set(status) {
- this.setLocalStorage('showLanguages', status)
+ this.setShowConfig('showLanguages', status)
},
},
showLastLogin: {
get() {
- return this.getLocalstorage('showLastLogin')
+ return this.showConfig.showLastLogin
},
set(status) {
- this.setLocalStorage('showLastLogin', status)
+ this.setShowConfig('showLastLogin', status)
},
},
showUserBackend: {
get() {
- return this.getLocalstorage('showUserBackend')
+ return this.showConfig.showUserBackend
},
set(status) {
- this.setLocalStorage('showUserBackend', status)
+ this.setShowConfig('showUserBackend', status)
},
},
showStoragePath: {
get() {
- return this.getLocalstorage('showStoragePath')
+ return this.showConfig.showStoragePath
},
set(status) {
- this.setLocalStorage('showStoragePath', status)
+ this.setShowConfig('showStoragePath', status)
},
},
@@ -221,18 +211,8 @@ export default {
},
methods: {
- getLocalstorage(key) {
- // force initialization
- const localConfig = JSON.parse(this.localStorage.getItem(key) ?? 'null')
- // if localstorage is null, fallback to original values
- this.$store.commit('setShowConfig', { key, value: localConfig !== null ? localConfig === 'true' : this.showConfig[key] })
- return this.showConfig[key]
- },
-
- setLocalStorage(key, status) {
+ setShowConfig(key, status) {
this.$store.commit('setShowConfig', { key, value: status })
- this.localStorage.setItem(key, JSON.stringify(status))
- return status
},
/**
diff --git a/apps/settings/src/store/users.js b/apps/settings/src/store/users.js
index a22ad4af43a..7fbd6cd7230 100644
--- a/apps/settings/src/store/users.js
+++ b/apps/settings/src/store/users.js
@@ -27,6 +27,7 @@
*
*/
+import { getBuilder } from '@nextcloud/browser-storage'
import { getCapabilities } from '@nextcloud/capabilities'
import { parseFileSize } from '@nextcloud/files'
import { generateOcsUrl } from '@nextcloud/router'
@@ -35,6 +36,8 @@ import axios from '@nextcloud/axios'
import api from './api.js'
import logger from '../logger.ts'
+const localStorage = getBuilder('settings').persist(true).build()
+
const orderGroups = function(groups, orderBy) {
/* const SORT_USERCOUNT = 1;
* const SORT_GROUPNAME = 2;
@@ -69,11 +72,11 @@ const state = {
disabledUsersLimit: 25,
userCount: 0,
showConfig: {
- showStoragePath: false,
- showUserBackend: false,
- showLastLogin: false,
- showNewUserForm: false,
- showLanguages: false,
+ showStoragePath: localStorage.getItem('account_settings__showStoragePath') === 'true',
+ showUserBackend: localStorage.getItem('account_settings__showUserBackend') === 'true',
+ showLastLogin: localStorage.getItem('account_settings__showLastLogin') === 'true',
+ showNewUserForm: localStorage.getItem('account_settings__showNewUserForm') === 'true',
+ showLanguages: localStorage.getItem('account_settings__showLanguages') === 'true',
},
}
@@ -248,6 +251,7 @@ const mutations = {
},
setShowConfig(state, { key, value }) {
+ localStorage.setItem(`account_settings__${key}`, JSON.stringify(value))
state.showConfig[key] = value
},
}