summaryrefslogtreecommitdiffstats
path: root/src/store
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-09-25 11:50:04 +0200
committerJoas Schilling <coding@schilljs.com>2020-12-10 11:47:04 +0100
commit4ebae32362d081c144717c58d4549e22aabb683e (patch)
treef6754757d82a1f6eaf2e5ef81a37cf58c2deeb33 /src/store
parentb672400bf05ecb9f4ed05538b1ccaeb8aea2d668 (diff)
Introduce a privacy settings for the read_status
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/index.js18
-rw-r--r--src/store/settingsStore.js58
2 files changed, 68 insertions, 8 deletions
diff --git a/src/store/index.js b/src/store/index.js
index 5a9e721d9..b36648019 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -23,18 +23,19 @@
import Vue from 'vue'
import Vuex, { Store } from 'vuex'
import actorStore from './actorStore'
+import callViewStore from './callViewStore'
import conversationsStore from './conversationsStore'
+import fileUploadStore from './fileUploadStore'
import guestNameStore from './guestNameStore'
import messagesStore from './messagesStore'
+import newGroupConversationStore from './newGroupConversationStore'
import participantsStore from './participantsStore'
import quoteReplyStore from './quoteReplyStore'
+import settingsStore from './settingsStore'
import sidebarStore from './sidebarStore'
+import talkHashStore from './talkHashStore'
import tokenStore from './tokenStore'
import windowVisibilityStore from './windowVisibilityStore'
-import fileUploadStore from './fileUploadStore'
-import newGroupConversationStore from './newGroupConversationStore'
-import callViewStore from './callViewStore'
-import talkHashStore from './talkHashStore'
Vue.use(Vuex)
@@ -43,18 +44,19 @@ const mutations = {}
export default new Store({
modules: {
actorStore,
+ callViewStore,
conversationsStore,
+ fileUploadStore,
guestNameStore,
messagesStore,
+ newGroupConversationStore,
participantsStore,
quoteReplyStore,
+ settingsStore,
sidebarStore,
+ talkHashStore,
tokenStore,
windowVisibilityStore,
- fileUploadStore,
- newGroupConversationStore,
- callViewStore,
- talkHashStore,
},
mutations,
diff --git a/src/store/settingsStore.js b/src/store/settingsStore.js
new file mode 100644
index 000000000..b8b0ead9e
--- /dev/null
+++ b/src/store/settingsStore.js
@@ -0,0 +1,58 @@
+/**
+ * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+import { loadState } from '@nextcloud/initial-state'
+
+const state = {
+ readStatusPrivacy: loadState('talk', 'read_status_privacy'),
+}
+
+const getters = {
+ getReadStatusPrivacy: (state) => () => {
+ return state.readStatusPrivacy
+ },
+}
+
+const mutations = {
+ /**
+ * Updates the token
+ *
+ * @param {object} state current store state;
+ * @param {string} privacy The token of the active conversation
+ */
+ updateReadStatusPrivacy(state, privacy) {
+ state.readStatusPrivacy = privacy
+ },
+}
+
+const actions = {
+
+ /**
+ * Updates the token
+ *
+ * @param {object} context default store context;
+ * @param {string} privacy The new selected privacy
+ */
+ updateReadStatusPrivacy(context, privacy) {
+ context.commit('updateReadStatusPrivacy', privacy)
+ },
+}
+
+export default { state, mutations, getters, actions }