feat: Lobby chat (#10847)

* feat(lobby): lobby chat

lobby chat support
knocking participants list updates
knocking participants conditonal checks to show message button
handle lobby chat message events
lobby messages from or to moderators only

Co-authored-by: Fecri Kaan Ulubey <f.kaan93@gmail.com>

* squash: Drop typos.

Co-authored-by: Kusi Musah Hussein <kusimusah@gmail.com>
Co-authored-by: Fecri Kaan Ulubey <f.kaan93@gmail.com>
Co-authored-by: Дамян Минков <damencho@jitsi.org>
This commit is contained in:
Doganbros
2022-03-03 20:29:38 +03:00
committed by GitHub
parent 7a4a234f8e
commit 7522de033a
38 changed files with 1401 additions and 95 deletions

View File

@@ -2,8 +2,9 @@
import { PureComponent } from 'react';
import { getParticipantDisplayName } from '../../base/participants';
import { getParticipantDisplayName, isLocalParticipantModerator } from '../../base/participants';
import { setPrivateMessageRecipient } from '../actions';
import { setLobbyChatActiveState } from '../actions.any';
export type Props = {
@@ -17,10 +18,30 @@ export type Props = {
*/
_onRemovePrivateMessageRecipient: Function,
/**
* Function to make the lobby message receipient inactive.
*/
_onHideLobbyChatRecipient: Function,
/**
* The name of the message recipient, if any.
*/
_privateMessageRecipient: ?string
_privateMessageRecipient: ?string,
/**
* Is lobby messaging active.
*/
_isLobbyChatActive: boolean,
/**
* The name of the lobby message recipient, if any.
*/
_lobbyMessageRecipient: ?string,
/**
* Shows widget if it is necessary.
*/
_visible: boolean;
};
/**
@@ -40,6 +61,9 @@ export function _mapDispatchToProps(dispatch: Function): $Shape<Props> {
return {
_onRemovePrivateMessageRecipient: () => {
dispatch(setPrivateMessageRecipient());
},
_onHideLobbyChatRecipient: () => {
dispatch(setLobbyChatActiveState(false));
}
};
}
@@ -51,10 +75,14 @@ export function _mapDispatchToProps(dispatch: Function): $Shape<Props> {
* @returns {Props}
*/
export function _mapStateToProps(state: Object): $Shape<Props> {
const { privateMessageRecipient } = state['features/chat'];
const { privateMessageRecipient, lobbyMessageRecipient, isLobbyChatActive } = state['features/chat'];
return {
_privateMessageRecipient:
privateMessageRecipient ? getParticipantDisplayName(state, privateMessageRecipient.id) : undefined
privateMessageRecipient ? getParticipantDisplayName(state, privateMessageRecipient.id) : undefined,
_isLobbyChatActive: isLobbyChatActive,
_lobbyMessageRecipient:
isLobbyChatActive && lobbyMessageRecipient ? lobbyMessageRecipient.name : undefined,
_visible: isLobbyChatActive ? isLocalParticipantModerator(state) : true
};
}