ref(api): move participant join and left to middleware (#4365)
This commit is contained in:
parent
0a76eebca7
commit
2f626ea474
|
@ -1713,14 +1713,7 @@ export default {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const displayName = user.getDisplayName();
|
|
||||||
|
|
||||||
logger.log(`USER ${id} connnected:`, user);
|
logger.log(`USER ${id} connnected:`, user);
|
||||||
APP.API.notifyUserJoined(id, {
|
|
||||||
displayName,
|
|
||||||
formattedDisplayName: appendSuffix(
|
|
||||||
displayName || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME)
|
|
||||||
});
|
|
||||||
APP.UI.addUser(user);
|
APP.UI.addUser(user);
|
||||||
|
|
||||||
// check the roles for the new user and reflect them
|
// check the roles for the new user and reflect them
|
||||||
|
@ -1736,7 +1729,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.log(`USER ${id} LEFT:`, user);
|
logger.log(`USER ${id} LEFT:`, user);
|
||||||
APP.API.notifyUserLeft(id);
|
|
||||||
APP.UI.onSharedVideoStop(id);
|
APP.UI.onSharedVideoStop(id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* @param {string} suffix - Suffix that will be appended.
|
* @param {string} suffix - Suffix that will be appended.
|
||||||
* @returns {string} The formatted display name.
|
* @returns {string} The formatted display name.
|
||||||
*/
|
*/
|
||||||
export function appendSuffix(displayName: string, suffix: string) {
|
export function appendSuffix(displayName: string, suffix: string = '') {
|
||||||
return `${displayName || suffix || ''}${
|
return `${displayName || suffix}${
|
||||||
displayName && suffix && displayName !== suffix ? ` (${suffix})` : ''}`;
|
displayName && suffix && displayName !== suffix ? ` (${suffix})` : ''}`;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
|
||||||
import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
|
import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
|
||||||
import {
|
import {
|
||||||
PARTICIPANT_KICKED,
|
PARTICIPANT_KICKED,
|
||||||
|
PARTICIPANT_LEFT,
|
||||||
|
PARTICIPANT_JOINED,
|
||||||
SET_LOADABLE_AVATAR_URL,
|
SET_LOADABLE_AVATAR_URL,
|
||||||
getLocalParticipant,
|
getLocalParticipant,
|
||||||
getParticipantById
|
getParticipantById
|
||||||
|
@ -129,6 +131,27 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
{ id: action.kicker });
|
{ id: action.kicker });
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PARTICIPANT_LEFT:
|
||||||
|
APP.API.notifyUserLeft(action.participant.id);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PARTICIPANT_JOINED: {
|
||||||
|
const { participant } = action;
|
||||||
|
const { id, local, name } = participant;
|
||||||
|
|
||||||
|
// The version of external api outside of middleware did not emit
|
||||||
|
// the local participant being created.
|
||||||
|
if (!local) {
|
||||||
|
APP.API.notifyUserJoined(id, {
|
||||||
|
displayName: name,
|
||||||
|
formattedDisplayName: appendSuffix(
|
||||||
|
name || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SET_FILMSTRIP_VISIBLE:
|
case SET_FILMSTRIP_VISIBLE:
|
||||||
APP.API.notifyFilmstripDisplayChanged(action.visible);
|
APP.API.notifyFilmstripDisplayChanged(action.visible);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue