fix: honor updates of the local user role before conference join

When the prosody setting has muc_allowners, everyone joins as a
moderator. In this case, the local user will not be set as a
moderator in the redux store as the USER_ROLE_CHANGE event will
trigger with the local user id before the redux store has set
the actual local user id--something that happens on
CONFERENCE_JOINED. The fix is to explicitly signal the local user
role has changed to the redux store, which follows the
implementation of pre-existing web logic.
This commit is contained in:
Leonard Kim
2017-04-18 14:14:04 -05:00
committed by Lyubo Marinov
parent c34e841710
commit a82bc1df64
2 changed files with 28 additions and 8 deletions
+22 -7
View File
@@ -29,15 +29,12 @@ export function dominantSpeakerChanged(id) {
}
/**
* Action to signal that ID of local participant has changed. This happens when
* local participant joins a new conference or quits one.
* Action to signal that the ID of local participant has changed. It happens
* when the local participant joins a new conference or leaves an existing
* conference.
*
* @param {string} id - New ID for local participant.
* @returns {{
* type: PARTICIPANT_ID_CHANGED,
* newValue: string,
* oldValue: string
* }}
* @returns {Function}
*/
export function localParticipantIdChanged(id) {
return (dispatch, getState) => {
@@ -69,6 +66,24 @@ export function localParticipantJoined(participant = {}) {
});
}
/**
* Action to signal the role of the local participant has changed. It can happen
* when the participant has joined a conference, even before a non-default local
* id has been set, or after a moderator leaves.
*
* @param {string} role - The new role of the local participant.
* @returns {Function}
*/
export function localParticipantRoleChanged(role) {
return (dispatch, getState) => {
const participant = getLocalParticipant(getState);
if (participant) {
return dispatch(participantRoleChanged(participant.id, role));
}
};
}
/**
* Action to update a participant's connection status.
*