Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/store
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-10-12 23:07:27 +0300
committerJoas Schilling <coding@schilljs.com>2021-10-12 23:08:17 +0300
commitb153979ad9e50048c9e22276fa01e45fe995fb53 (patch)
tree0e1daba74c06cbaa922eae6b5357377c2d619c8e /src/store
parent17865834a640a3e32dae60b880bf060955f71870 (diff)
Reuse the participant information if we have a userId
All information required by the code calling getPeer() is also available in the participants data, so we don't run the request to get the data from "GET /call" Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/participantsStore.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js
index 3ec1ac21b..7f1799d8e 100644
--- a/src/store/participantsStore.js
+++ b/src/store/participantsStore.js
@@ -94,13 +94,19 @@ const getters = {
return index
},
- getPeer: (state) => (token, sessionId) => {
- if (!state.peers[token]) {
- return {}
+ getPeer: (state) => (token, sessionId, userId) => {
+ if (state.peers[token]) {
+ if (Object.prototype.hasOwnProperty.call(state.peers[token], sessionId)) {
+ return state.peers[token][sessionId]
+ }
}
- if (Object.prototype.hasOwnProperty.call(state.peers[token], sessionId)) {
- return state.peers[token][sessionId]
+ // Fallback to the participant list, if we have a user id that should be easy
+ if (state.participants[token] && userId) {
+ const index = state.participants[token].findIndex(participant => participant.actorId === userId && participant.actorType === 'users')
+ if (index !== -1) {
+ return state.participants[token][index]
+ }
}
return {}