Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-11-16 10:56:21 +0300
committerJoas Schilling <coding@schilljs.com>2021-11-16 11:17:04 +0300
commit1491f9d27d8e8cc22acd84cb83387c1d6c83a828 (patch)
tree08ff96b39b38612d2dc6554a0098d520d45cc70a /src/store
parentf4e8b0d748fcc176321cac266bcca784d070fd1a (diff)
Overwrite hasCall based on chat messages
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/conversationsStore.js12
-rw-r--r--src/store/messagesStore.js18
2 files changed, 30 insertions, 0 deletions
diff --git a/src/store/conversationsStore.js b/src/store/conversationsStore.js
index 2105a302f..27dd0ecbd 100644
--- a/src/store/conversationsStore.js
+++ b/src/store/conversationsStore.js
@@ -136,6 +136,14 @@ const mutations = {
}
},
+ overwriteHasCallByChat(state, { token, hasCall }) {
+ if (hasCall) {
+ Vue.set(state.conversations[token], 'hasCallOverwrittenByChat', hasCall)
+ } else {
+ Vue.delete(state.conversations[token], 'hasCallOverwrittenByChat')
+ }
+ },
+
setNotificationLevel(state, { token, notificationLevel }) {
Vue.set(state.conversations[token], 'notificationLevel', notificationLevel)
},
@@ -415,6 +423,10 @@ const actions = {
commit('updateConversationLastReadMessage', { token, lastReadMessage })
},
+ async overwriteHasCallByChat({ commit }, { token, hasCall }) {
+ commit('overwriteHasCallByChat', { token, hasCall })
+ },
+
async fetchConversation({ dispatch }, { token }) {
try {
dispatch('clearMaintenanceMode')
diff --git a/src/store/messagesStore.js b/src/store/messagesStore.js
index c54c8e60b..3c08544e3 100644
--- a/src/store/messagesStore.js
+++ b/src/store/messagesStore.js
@@ -722,6 +722,24 @@ const actions = {
lastMessage = message
}
+ // Overwrite the conversation.hasCall property so people can join
+ // after seeing the message in the chat.
+ if (conversation && conversation.lastMessage && message.id > conversation.lastMessage.id) {
+ if (message.systemMessage === 'call_started') {
+ context.dispatch('overwriteHasCallByChat', {
+ token,
+ hasCall: true,
+ })
+ } else if (message.systemMessage === 'call_ended'
+ || message.systemMessage === 'call_ended_everyone'
+ || message.systemMessage === 'call_missed') {
+ context.dispatch('overwriteHasCallByChat', {
+ token,
+ hasCall: false,
+ })
+ }
+ }
+
// in case we encounter an already read message, reset the counter
// this is probably unlikely to happen unless one starts browsing from
// an earlier page and scrolls down