diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/SettingsDialog/SettingsDialog.vue | 16 | ||||
-rw-r--r-- | src/store/settingsStore.js | 8 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/components/SettingsDialog/SettingsDialog.vue b/src/components/SettingsDialog/SettingsDialog.vue index d62196a5b..39da96b91 100644 --- a/src/components/SettingsDialog/SettingsDialog.vue +++ b/src/components/SettingsDialog/SettingsDialog.vue @@ -106,10 +106,7 @@ <script> import { getFilePickerBuilder, showError } from '@nextcloud/dialogs' -import { - setAttachmentFolder, - setReadStatusPrivacy, -} from '../../services/settingsService' +import { setAttachmentFolder } from '../../services/settingsService' import { PRIVACY } from '../../constants' import { subscribe, unsubscribe } from '@nextcloud/event-bus' import MediaDevicesPreview from '../MediaDevicesPreview' @@ -191,14 +188,11 @@ export default { }, async toggleReadStatusPrivacy() { - let newPrivacy = PRIVACY.PUBLIC - if (this.readStatusPrivacyIsPublic) { - newPrivacy = PRIVACY.PRIVATE - } - try { - this.$store.commit('updateReadStatusPrivacy', newPrivacy) - await setReadStatusPrivacy(newPrivacy) + await this.$store.commit( + 'updateReadStatusPrivacy', + this.readStatusPrivacyIsPublic ? PRIVACY.PRIVATE : PRIVACY.PUBLIC + ) } catch (exception) { showError(t('spreed', 'Error while setting read status privacy')) } diff --git a/src/store/settingsStore.js b/src/store/settingsStore.js index b8b0ead9e..a8bd04eef 100644 --- a/src/store/settingsStore.js +++ b/src/store/settingsStore.js @@ -19,6 +19,7 @@ */ import { loadState } from '@nextcloud/initial-state' +import { setReadStatusPrivacy } from '../services/settingsService' const state = { readStatusPrivacy: loadState('talk', 'read_status_privacy'), @@ -45,12 +46,13 @@ const mutations = { const actions = { /** - * Updates the token + * Update the read status privacy for the user * * @param {object} context default store context; - * @param {string} privacy The new selected privacy + * @param {int} privacy The new selected privacy */ - updateReadStatusPrivacy(context, privacy) { + async updateReadStatusPrivacy(context, privacy) { + await setReadStatusPrivacy(privacy) context.commit('updateReadStatusPrivacy', privacy) }, } |