diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-08-13 06:26:38 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-08-15 03:39:56 +0000 |
commit | 55fa2cc5467a22e4c59221245c04da34e29c8748 (patch) | |
tree | 9387c4378c57416493ea65740f74568b111f689c | |
parent | 259d43051a5e9296ed8cb48329065352d5e52d76 (diff) |
Reorder blocks to match the normal flow of state changes
After being initialized the speaking value will be first modified when
the participant starts speaking, and then once the participant stops
speaking.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
-rw-r--r-- | src/store/participantsStore.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js index d563967a2..65e4fd1f6 100644 --- a/src/store/participantsStore.js +++ b/src/store/participantsStore.js @@ -369,13 +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].speaking = false - state.speaking[token][sessionId].totalCountedTime += (currentTimestamp - state.speaking[token][sessionId].lastTimestamp) - } else if (!currentSpeakingState && 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) } }, |