From 1e3107771b82640651c478ed990d29aa73089046 Mon Sep 17 00:00:00 2001
From: Joas Schilling <coding@schilljs.com>
Date: Thu, 10 Dec 2020 11:46:47 +0100
Subject: Do the request via the store

Signed-off-by: Joas Schilling <coding@schilljs.com>
---
 src/components/SettingsDialog/SettingsDialog.vue | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

(limited to 'src/components/SettingsDialog/SettingsDialog.vue')

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'))
 			}
-- 
cgit v1.2.3

