Browse Source

Merge pull request #10201 from nextcloud/simplify-tracking-of-total-counted-time

Simplify tracking of total counted time
pull/10214/head
Daniel Calviño Sánchez 2 years ago
committed by GitHub
parent
commit
5f09e11ee4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue
  2. 18
      src/store/participantsStore.js

8
src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue

@ -40,7 +40,7 @@
disable-tooltip
:show-user-status="showUserStatus && !isSearched"
:preloaded-user-status="preloadedUserStatus"
:highlighted="isParticipantSpeaking"
:highlighted="isSpeakingStatusAvailable && isParticipantSpeaking"
:offline="isOffline" />
<!-- Participant's data -->
@ -349,8 +349,12 @@ export default {
return text
},
isSpeakingStatusAvailable() {
return this.isInCall && !!this.participant.inCall && !!this.timeSpeaking
},
statusMessage() {
if (this.isInCall && this.participant.inCall && this.timeSpeaking) {
if (this.isSpeakingStatusAvailable) {
return this.isParticipantSpeaking
? '💬 ' + t('spreed', '{time} talking …', { time: formattedTime(this.timeSpeaking, true) })
: '💬 ' + t('spreed', '{time} talking time', { time: formattedTime(this.timeSpeaking, true) })

18
src/store/participantsStore.js

@ -348,8 +348,8 @@ const mutations = {
* property to an existing participant, as the participant would be reset
* when the participants are purged whenever they are fetched again.
* Similarly, "addParticipant" can not be called either to add a participant
* if it was not fetched yet but the signaling reported it as being speaking,
* as the attendeeId would be unknown.
* if it was not fetched yet but the call model reported it as being
* speaking, as the attendeeId would be unknown.
*
* @param {object} state - current store state.
* @param {object} data - the wrapping object.
@ -369,15 +369,13 @@ const mutations = {
const currentTimestamp = Date.now()
const currentSpeakingState = state.speaking[token][sessionId].speaking
// when speaking has stopped, update the total talking time
if (currentSpeakingState && !speaking && state.speaking[token][sessionId].lastTimestamp) {
state.speaking[token][sessionId].totalCountedTime += (currentTimestamp - state.speaking[token][sessionId].lastTimestamp)
}
// don't change state for consecutive identical signals
if (currentSpeakingState !== speaking) {
state.speaking[token][sessionId].speaking = speaking
if (!currentSpeakingState && speaking) {
state.speaking[token][sessionId].speaking = true
state.speaking[token][sessionId].lastTimestamp = currentTimestamp
} else if (currentSpeakingState && !speaking) {
// when speaking has stopped, update the total talking time
state.speaking[token][sessionId].speaking = false
state.speaking[token][sessionId].totalCountedTime += (currentTimestamp - state.speaking[token][sessionId].lastTimestamp)
}
},

Loading…
Cancel
Save