Skip to content

Commit

Permalink
ref(lobby chat) sync current lobby chat lib jitsi api
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhstar committed Feb 6, 2022
1 parent 6d76f2b commit 1ace000
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions react/features/chat/actions.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export function onLobbyChatInitialized(lobbyChatInititializedInfo: Object) {
const state = getState();
const conference = getCurrentConference(state);

const lobbyLocalId = conference.getLobbyLocalId();
const lobbyLocalId = conference.myLobbyUserId();

if (!lobbyLocalId) {
return;
Expand Down Expand Up @@ -226,7 +226,7 @@ export function handleLobbyChatInitialized(participantId: string) {
const { knockingParticipants } = state['features/lobby'];
const { lobbyMessageRecipient } = state['features/chat'];
const me = getLocalParticipant(state);
const lobbyLocalId = conference.getLobbyLocalId();
const lobbyLocalId = conference.myLobbyUserId();


if (lobbyMessageRecipient && lobbyMessageRecipient.id === participantId) {
Expand Down Expand Up @@ -256,7 +256,7 @@ export function handleLobbyChatInitialized(participantId: string) {
attendee };

// notify attendee privately.
conference.sendPrivateLobbyMessage(attendee.id, payload);
conference.sendLobbyMessage(payload, attendee.id);

// notify other moderators.
return conference.sendLobbyMessage(payload);
Expand Down
4 changes: 2 additions & 2 deletions react/features/chat/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ MiddlewareRegistry.register(store => next => action => {
}

if (isLobbyChatActive && lobbyMessageRecipient) {
conference.sendPrivateLobbyMessage(lobbyMessageRecipient.id, {
conference.sendLobbyMessage({
type: LOBBY_CHAT_MESSAGE,
message: action.message
});
}, lobbyMessageRecipient.id);
_persistSentPrivateMessage(store, lobbyMessageRecipient.id, action.message, true);
} else if (privateMessageRecipient) {
conference.sendPrivateTextMessage(privateMessageRecipient.id, action.message);
Expand Down
14 changes: 7 additions & 7 deletions react/features/lobby/actions.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function startKnocking() {
sendLocalParticipant(state, membersOnly);

membersOnly.joinLobby(localParticipant.name, localParticipant.email);
dispatch(setLobbyChatListener());
dispatch(setLobbyMessageListener());
dispatch(setKnockingState(true));
};
}
Expand Down Expand Up @@ -265,7 +265,7 @@ export function handleLobbyChatInitialized(payload: Object) {
const state = getState();
const conference = getCurrentConference(state);

const id = conference.getLobbyLocalId();
const id = conference.myLobbyUserId();

dispatch({
type: SET_LOBBY_PARTICIPANT_CHAT_STATE,
Expand Down Expand Up @@ -328,7 +328,7 @@ export function maybeSetLobbyChatMessageListener() {
const lobbyEnabled = getLobbyEnabled(state);

if (lobbyEnabled) {
dispatch(setLobbyChatListener());
dispatch(setLobbyMessageListener());
}
};
}
Expand All @@ -355,10 +355,10 @@ export function updateLobbyParticipantOnModeratorLeave(participantId: string) {
const participantToNotify = knockingParticipants.find(p => p.chattingWithModerator === participantId);

if (participantToNotify) {
conference.sendPrivateLobbyMessage(participantToNotify.id, {
conference.sendLobbyMessage({
type: MODERATOR_IN_CHAT_WITH_LEFT,
moderatorId: participantToNotify.chattingWithModerator
});
}, participantToNotify.id);
}
dispatch({
type: REMOVE_LOBBY_CHAT_WITH_MODERATOR,
Expand All @@ -373,7 +373,7 @@ export function updateLobbyParticipantOnModeratorLeave(participantId: string) {
*
* @returns {Function}
*/
export function setLobbyChatListener() {
export function setLobbyMessageListener() {
return async (dispatch: Dispatch<any>, getState: Function) => {
const state = getState();
const conference = getCurrentConference(state);
Expand All @@ -383,7 +383,7 @@ export function setLobbyChatListener() {
return;
}

conference.setLobbyMessageListener((message: Object, participantId: string) => {
conference.addLobbyMessageListener((message: Object, participantId: string) => {
if (message.type === LOBBY_CHAT_MESSAGE) {
return dispatch(handleLobbyMessageReceived(message.message, participantId));
}
Expand Down
2 changes: 1 addition & 1 deletion react/features/lobby/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function showLobbyChatButton(
const { lobbyMessageRecipient, isLobbyChatActive } = state['features/chat'];
const conference = getCurrentConference(state);

const lobbyLocalId = conference.getLobbyLocalId();
const lobbyLocalId = conference.myLobbyUserId();

if (!enableLobbyChat) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions react/features/lobby/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
setLobbyModeEnabled,
startKnocking,
setPasswordJoinFailed,
setLobbyChatListener
setLobbyMessageListener
} from './actions';
import { updateLobbyParticipantOnModeratorLeave } from './actions.any';
import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
Expand Down Expand Up @@ -82,7 +82,7 @@ StateListenerRegistry.register(
conference.on(JitsiConferenceEvents.MEMBERS_ONLY_CHANGED, enabled => {
dispatch(setLobbyModeEnabled(enabled));
if (enabled) {
dispatch(setLobbyChatListener());
dispatch(setLobbyMessageListener());
}
});

Expand Down

0 comments on commit 1ace000

Please sign in to comment.