From 1491f9d27d8e8cc22acd84cb83387c1d6c83a828 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 16 Nov 2021 08:56:21 +0100 Subject: [PATCH 1/2] Overwrite hasCall based on chat messages Signed-off-by: Joas Schilling --- src/components/TopBar/CallButton.vue | 16 ++++++++++------ src/store/conversationsStore.js | 12 ++++++++++++ src/store/messagesStore.js | 18 ++++++++++++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/components/TopBar/CallButton.vue b/src/components/TopBar/CallButton.vue index 1e9594934..af23467a5 100644 --- a/src/components/TopBar/CallButton.vue +++ b/src/components/TopBar/CallButton.vue @@ -155,9 +155,13 @@ export default { || this.participantType === PARTICIPANT.TYPE.GUEST_MODERATOR) }, + hasCall() { + return this.conversation.hasCall || this.conversation.hasCallOverwrittenByChat + }, + startCallButtonDisabled() { return (!this.conversation.canStartCall - && !this.conversation.hasCall) + && !this.hasCall) || this.isInLobby || this.conversation.readOnly || this.isNextcloudTalkHashDirty @@ -177,7 +181,7 @@ export default { }, startCallLabel() { - if (this.conversation.hasCall && !this.isInLobby) { + if (this.hasCall && !this.isInLobby) { return t('spreed', 'Join call') } @@ -193,7 +197,7 @@ export default { return this.callButtonTooltipText } - if (!this.conversation.canStartCall && !this.conversation.hasCall) { + if (!this.conversation.canStartCall && !this.hasCall) { return t('spreed', 'You will be able to join the call only after a moderator starts it.') } @@ -205,7 +209,7 @@ export default { return 'icon-loading-small' } - if (this.conversation.hasCall && !this.isInLobby) { + if (this.hasCall && !this.isInLobby) { return 'icon-incoming-call' } @@ -214,8 +218,8 @@ export default { startCallButtonClasses() { return { - primary: !this.conversation.hasCall && !this.isInLobby, - success: this.conversation.hasCall && !this.isInLobby, + primary: !this.hasCall && !this.isInLobby, + success: this.hasCall && !this.isInLobby, } }, 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 From da20f4bbfeb369a823288a5af5dac3756f57ee6f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 16 Nov 2021 09:17:15 +0100 Subject: [PATCH 2/2] Always print a message for now Signed-off-by: Joas Schilling --- lib/Activity/Listener.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php index d38bda37d..5228befde 100644 --- a/lib/Activity/Listener.php +++ b/lib/Activity/Listener.php @@ -133,15 +133,10 @@ class Listener { $numGuests = $this->participantService->getGuestCount($room, $activeSince); $message = 'call_ended'; - if ((\count($userIds) + $numGuests) === 1) { - if ($room->getType() !== Room::TYPE_ONE_TO_ONE) { - // Single user pinged or guests only => no summary/activity - $room->resetActiveSince(); - return false; - } - $message = 'call_missed'; - } elseif ($endForEveryone) { + if ($endForEveryone) { $message = 'call_ended_everyone'; + } elseif ($room->getType() === Room::TYPE_ONE_TO_ONE) { + $message = 'call_missed'; } if (!$room->resetActiveSince()) {