Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,10 @@ public function generateCallActivity(Room $room, bool $endForEveryone = false, ?
$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()) {
Expand Down
16 changes: 10 additions & 6 deletions src/components/TopBar/CallButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -177,7 +181,7 @@ export default {
},

startCallLabel() {
if (this.conversation.hasCall && !this.isInLobby) {
if (this.hasCall && !this.isInLobby) {
return t('spreed', 'Join call')
}

Expand All @@ -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.')
}

Expand All @@ -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'
}

Expand All @@ -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,
}
},

Expand Down
12 changes: 12 additions & 0 deletions src/store/conversationsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down Expand Up @@ -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')
Expand Down
18 changes: 18 additions & 0 deletions src/store/messagesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down