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
User participants are identified by userId in the participant store, …
…not by participant

Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Apr 27, 2020
commit e530c95ada99390eef6702d1f8ad2ad2050909dc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export default {
}
} else {
data = {
participant: this.computedId,
userId: this.computedId,
}
}
return data
Expand Down
2 changes: 1 addition & 1 deletion src/store/actorStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getters = {
}
}
return {
participant: state.userId,
userId: state.userId,
}
},
}
Expand Down
24 changes: 20 additions & 4 deletions src/store/participantsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 = {
Expand All @@ -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 = {
Expand Down