From e530c95ada99390eef6702d1f8ad2ad2050909dc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 16 Apr 2020 12:25:36 +0200 Subject: [PATCH] User participants are identified by userId in the participant store, not by participant Signed-off-by: Joas Schilling --- .../Participant/Participant.vue | 2 +- src/store/actorStore.js | 2 +- src/store/participantsStore.js | 24 +++++++++++++++---- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue index 7f5337f1733..05514dcf844 100644 --- a/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue +++ b/src/components/RightSidebar/Participants/ParticipantsList/Participant/Participant.vue @@ -224,7 +224,7 @@ export default { } } else { data = { - participant: this.computedId, + userId: this.computedId, } } return data diff --git a/src/store/actorStore.js b/src/store/actorStore.js index de638e8dde8..d75fa4e2e77 100644 --- a/src/store/actorStore.js +++ b/src/store/actorStore.js @@ -65,7 +65,7 @@ const getters = { } } return { - participant: state.userId, + userId: state.userId, } }, } diff --git a/src/store/participantsStore.js b/src/store/participantsStore.js index 3c4e4c4c138..fc71d94130e 100644 --- a/src/store/participantsStore.js +++ b/src/store/participantsStore.js @@ -62,8 +62,8 @@ const getters = { let index - if (participantIdentifier.hasOwnProperty('participant')) { - index = state.participants[token].findIndex(participant => participant.userId === participantIdentifier.participant) + if (participantIdentifier.hasOwnProperty('userId')) { + index = state.participants[token].findIndex(participant => participant.userId === participantIdentifier.userId) } else { index = state.participants[token].findIndex(participant => participant.sessionId === participantIdentifier.sessionId) } @@ -144,7 +144,15 @@ const actions = { return } - await promoteToModerator(token, participantIdentifier) + if (participantIdentifier.userId) { + // Moderation endpoint requires "participant" instead of "userId" + await promoteToModerator(token, { + participant: participantIdentifier.userId, + }) + } else { + // Guests are identified by sessionId in both cases + await promoteToModerator(token, participantIdentifier) + } const participant = getters.getParticipant(token, index) const updatedData = { @@ -158,7 +166,15 @@ const actions = { return } - await demoteFromModerator(token, participantIdentifier) + if (participantIdentifier.userId) { + // Moderation endpoint requires "participant" instead of "userId" + await demoteFromModerator(token, { + participant: participantIdentifier.userId, + }) + } else { + // Guests are identified by sessionId in both cases + await demoteFromModerator(token, participantIdentifier) + } const participant = getters.getParticipant(token, index) const updatedData = {