зеркало из https://github.com/nextcloud/spreed.git
Merge pull request #6507 from nextcloud/bugfix/6447/avoid-delay-between-chat-message-and-conversation-state
Overwrite hasCall based on chat messages
This commit is contained in:
Коммит
091575237c
|
@ -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()) {
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче