Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(chat): Add disableChat configuration option
Hristo Terezov919c60b3d23e
diff --git a/config.js b/config.jsindex f567b32e29..be24f1a654 100644--- a/config.js+++ b/config.js@@ -139,6 +139,9 @@ var config = {// Disables polls feature.// disablePolls: false,+ // Disables chat feature entirely including notifications, sounds, and private messages.+ // disableChat: false,+// Disables demote button from self-view// disableSelfDemote: false,diff --git a/lang/main.json b/lang/main.jsonindex eac9d3f492..77cb6bf349 100644--- a/lang/main.json+++ b/lang/main.json@@ -126,8 +126,16 @@"messagebox": "Type a message","newMessages": "New messages","nickname": {+ "featureChat": "chat",+ "featureClosedCaptions": "closed captions",+ "featureFileSharing": "file sharing",+ "featurePolls": "polls","popover": "Choose a nickname","title": "Enter a nickname to use chat",+ "titleWith1Features": "Enter a nickname to use {{feature1}}",+ "titleWith2Features": "Enter a nickname to use {{feature1}} and {{feature2}}",+ "titleWith3Features": "Enter a nickname to use {{feature1}}, {{feature2}} and {{feature3}}",+ "titleWith4Features": "Enter a nickname to use {{feature1}}, {{feature2}}, {{feature3}} and {{feature4}}","titleWithCC": "Enter a nickname to use chat and closed captions","titleWithPolls": "Enter a nickname to use chat and polls","titleWithPollsAndCC": "Enter a nickname to use chat, polls and closed captions",diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.tsindex 31df87f5b9..e4bee21070 100644--- a/react/features/base/config/configType.ts+++ b/react/features/base/config/configType.ts@@ -285,6 +285,7 @@ export interface IConfig {disableAudioLevels?: boolean;disableBeforeUnloadHandlers?: boolean;disableCameraTintForeground?: boolean;+ disableChat?: boolean;disableChatSmileys?: boolean;disableDeepLinking?: boolean;disableFilmstripAutohiding?: boolean;diff --git a/react/features/base/config/configWhitelist.ts b/react/features/base/config/configWhitelist.tsindex 8484477bec..e5e78ecc85 100644--- a/react/features/base/config/configWhitelist.ts+++ b/react/features/base/config/configWhitelist.ts@@ -94,6 +94,7 @@ export default ['disableAudioLevels','disableBeforeUnloadHandlers','disableCameraTintForeground',+ 'disableChat','disableChatSmileys','disableDeepLinking','disabledNotifications',diff --git a/react/features/chat/actions.native.ts b/react/features/chat/actions.native.tsindex 1f70bbc0ff..8dbd9bfbe7 100644--- a/react/features/chat/actions.native.ts+++ b/react/features/chat/actions.native.ts@@ -1,30 +1,33 @@+import { IStore } from '../app/types';import { IParticipant } from '../base/participants/types';import { navigate } from '../mobile/navigation/components/conference/ConferenceNavigationContainerRef';import { screen } from '../mobile/navigation/routes';import { OPEN_CHAT } from './actionTypes';+import { setFocusedTab } from './actions.any';+import { ChatTabs } from './constants';export * from './actions.any';/**- * Displays the chat panel.+ * Displays the chat panel with the CHAT tab active.** @param {Object} participant - The recipient for the private chat.* @param {boolean} disablePolls - Checks if polls are disabled.*- * @returns {{- * participant: participant,- * type: OPEN_CHAT- * }}+ * @returns {Function}*/export function openChat(participant?: IParticipant | undefined | Object, disablePolls?: boolean) {- if (disablePolls) {- navigate(screen.conference.chat);- }- navigate(screen.conference.chatandpolls.main);+ return (dispatch: IStore['dispatch']) => {+ if (disablePolls) {+ navigate(screen.conference.chat);+ }+ navigate(screen.conference.chatandpolls.main);- return {- participant,- type: OPEN_CHAT+ dispatch(setFocusedTab(ChatTabs.CHAT));+ dispatch({+ participant,+ type: OPEN_CHAT+ });};}diff --git a/react/features/chat/actions.web.ts b/react/features/chat/actions.web.tsindex 2cdf57f4e2..eae25b8e97 100644--- a/react/features/chat/actions.web.ts+++ b/react/features/chat/actions.web.ts@@ -8,12 +8,13 @@ import {SET_CHAT_WIDTH,SET_USER_CHAT_WIDTH} from './actionTypes';-import { closeChat } from './actions.any';+import { closeChat, setFocusedTab } from './actions.any';+import { ChatTabs } from './constants';export * from './actions.any';/**- * Displays the chat panel.+ * Displays the chat panel with the CHAT tab active.** @param {Object} participant - The recipient for the private chat.* @param {Object} _disablePolls - Used on native.@@ -24,6 +25,7 @@ export * from './actions.any';*/export function openChat(participant?: Object, _disablePolls?: boolean) {return function(dispatch: IStore['dispatch']) {+ dispatch(setFocusedTab(ChatTabs.CHAT));dispatch({participant,type: OPEN_CHATdiff --git a/react/features/chat/components/native/ChatButton.ts b/react/features/chat/components/native/ChatButton.tsindex 5a5f67bea9..dcf50e4e12 100644--- a/react/features/chat/components/native/ChatButton.ts+++ b/react/features/chat/components/native/ChatButton.ts@@ -10,7 +10,7 @@ import { arePollsDisabled } from '../../../conference/functions.any';import { navigate } from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';import { screen } from '../../../mobile/navigation/routes';import { getUnreadPollCount } from '../../../polls/functions';-import { getUnreadCount, getUnreadFilesCount } from '../../functions';+import { getUnreadCount, getUnreadFilesCount, isChatDisabled } from '../../functions';interface IProps extends AbstractButtonProps {@@ -65,7 +65,7 @@ class ChatButton extends AbstractButton<IProps> {* @returns {IProps}*/function _mapStateToProps(state: IReduxState, ownProps: any) {- const enabled = getFeatureFlag(state, CHAT_ENABLED, true);+ const enabled = getFeatureFlag(state, CHAT_ENABLED, true) && !isChatDisabled(state);const { visible = enabled } = ownProps;return {diff --git a/react/features/chat/components/web/Chat.tsx b/react/features/chat/components/web/Chat.tsxindex a49c002c46..77c83c8604 100644--- a/react/features/chat/components/web/Chat.tsx+++ b/react/features/chat/components/web/Chat.tsx@@ -24,7 +24,7 @@ import {toggleChat} from '../../actions.web';import { CHAT_SIZE, ChatTabs, OPTION_GROUPCHAT, SMALL_WIDTH_THRESHOLD } from '../../constants';-import { getChatMaxSize } from '../../functions';+import { getChatMaxSize, getFocusedTab, isChatDisabled } from '../../functions';import { IChatProps as AbstractProps } from '../../types';import ChatHeader from './ChatHeader';@@ -41,13 +41,18 @@ interface IProps extends AbstractProps {/*** The currently focused tab.*/- _focusedTab: ChatTabs;+ _focusedTab?: ChatTabs;/*** True if the CC tab is enabled and false otherwise.*/_isCCTabEnabled: boolean;+ /**+ * True if chat is disabled.+ */+ _isChatDisabled: boolean;+/*** True if file sharing tab is enabled.*/@@ -217,6 +222,7 @@ const Chat = ({_isOpen,_isPollsEnabled,_isCCTabEnabled,+ _isChatDisabled,_isFileSharingTabEnabled,_focusedTab,_isResizing,@@ -229,6 +235,11 @@ const Chat = ({dispatch,t}: IProps) => {+ // If no tabs are available, don't render the chat panel at all.+ if (_isChatDisabled && !_isPollsEnabled && !_isCCTabEnabled && !_isFileSharingTabEnabled) {+ return null;+ }+const { classes, cx } = useStyles({ _isResizing, width: _width });const [ isMouseDown, setIsMouseDown ] = useState(false);const [ mousePosition, setMousePosition ] = useState<number | null>(null);@@ -416,7 +427,7 @@ const Chat = ({return (<>{renderTabs()}- <div+ {!_isChatDisabled && (<divaria-labelledby = { ChatTabs.CHAT }className = { cx(classes.chatPanel,@@ -442,7 +453,7 @@ const Chat = ({)}<ChatInputonSend = { onSendMessage } />- </div>+ </div>) }{ _isPollsEnabled && (<><div@@ -484,8 +495,18 @@ const Chat = ({* @returns {ReactElement}*/function renderTabs() {- let tabs = [- {+ // The only way focused tab will be undefined is when no tab is enabled. Therefore this function won't be+ // executed because Chat component won't render anything. This should never happen but adding the check+ // here to make TS happy (when passing the _focusedTab in the selected prop for Tabs).+ if (!_focusedTab) {+ return null;+ }++ let tabs = [];++ // Only add chat tab if chat is not disabled.+ if (!_isChatDisabled) {+ tabs.push({accessibilityLabel: t('chat.tabs.chat'),countBadge:_focusedTab !== ChatTabs.CHAT && _unreadMessagesCount > 0 ? _unreadMessagesCount : undefined,@@ -493,8 +514,8 @@ const Chat = ({controlsId: `${ChatTabs.CHAT}-panel`,icon: IconMessage,title: t('chat.tabs.chat')- }- ];+ });+ }if (_isPollsEnabled) {tabs.push({@@ -564,6 +585,8 @@ const Chat = ({{_showNamePrompt? <DisplayNameFormisCCTabEnabled = { _isCCTabEnabled }+ isChatDisabled = { _isChatDisabled }+ isFileSharingEnabled = { _isFileSharingTabEnabled }isPollsEnabled = { _isPollsEnabled } />: renderChat()}<div@@ -602,7 +625,7 @@ const Chat = ({* }}*/function _mapStateToProps(state: IReduxState, _ownProps: any) {- const { isOpen, focusedTab, messages, unreadMessagesCount, unreadFilesCount, width, isResizing } = state['features/chat'];+ const { isOpen, messages, unreadMessagesCount, unreadFilesCount, width, isResizing } = state['features/chat'];const { unreadPollsCount } = state['features/polls'];const _localParticipant = getLocalParticipant(state);@@ -611,8 +634,9 @@ function _mapStateToProps(state: IReduxState, _ownProps: any) {_isOpen: isOpen,_isPollsEnabled: !arePollsDisabled(state),_isCCTabEnabled: isCCTabEnabled(state),+ _isChatDisabled: isChatDisabled(state),_isFileSharingTabEnabled: isFileSharingEnabled(state),- _focusedTab: focusedTab,+ _focusedTab: getFocusedTab(state),_messages: messages,_unreadMessagesCount: unreadMessagesCount,_unreadPollsCount: unreadPollsCount,diff --git a/react/features/chat/components/web/ChatButton.tsx b/react/features/chat/components/web/ChatButton.tsxindex 60b6b13caf..84e31df061 100644--- a/react/features/chat/components/web/ChatButton.tsx+++ b/react/features/chat/components/web/ChatButton.tsx@@ -9,6 +9,7 @@ import { IconMessage } from '../../../base/icons/svg';import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';import { closeOverflowMenuIfOpen } from '../../../toolbox/actions.web';import { toggleChat } from '../../actions.web';+import { isChatDisabled } from '../../functions';import ChatCounter from './ChatCounter';@@ -91,7 +92,8 @@ class ChatButton extends AbstractButton<IProps> {*/const mapStateToProps = (state: IReduxState) => {return {- _chatOpen: state['features/chat'].isOpen+ _chatOpen: state['features/chat'].isOpen,+ visible: !isChatDisabled(state)};};diff --git a/react/features/chat/components/web/ChatHeader.tsx b/react/features/chat/components/web/ChatHeader.tsxindex 0019c06f99..7d6ce22a6f 100644--- a/react/features/chat/components/web/ChatHeader.tsx+++ b/react/features/chat/components/web/ChatHeader.tsx@@ -2,12 +2,12 @@ import React, { useCallback } from 'react';import { useTranslation } from 'react-i18next';import { useDispatch, useSelector } from 'react-redux';-import { IReduxState } from '../../../app/types';import Icon from '../../../base/icons/components/Icon';import { IconCloseLarge } from '../../../base/icons/svg';import { isFileSharingEnabled } from '../../../file-sharing/functions.any';import { toggleChat } from '../../actions.web';import { ChatTabs } from '../../constants';+import { getFocusedTab, isChatDisabled } from '../../functions';interface IProps {@@ -40,7 +40,8 @@ interface IProps {function ChatHeader({ className, isCCTabEnabled, isPollsEnabled }: IProps) {const dispatch = useDispatch();const { t } = useTranslation();- const { focusedTab } = useSelector((state: IReduxState) => state['features/chat']);+ const _isChatDisabled = useSelector(isChatDisabled);+ const focusedTab = useSelector(getFocusedTab);const fileSharingTabEnabled = useSelector(isFileSharingEnabled);const onCancel = useCallback(() => {@@ -56,7 +57,7 @@ function ChatHeader({ className, isCCTabEnabled, isPollsEnabled }: IProps) {let title = 'chat.title';- if (focusedTab === ChatTabs.CHAT) {+ if (!_isChatDisabled && focusedTab === ChatTabs.CHAT) {title = 'chat.tabs.chat';} else if (isPollsEnabled && focusedTab === ChatTabs.POLLS) {title = 'chat.tabs.polls';@@ -64,6 +65,11 @@ function ChatHeader({ className, isCCTabEnabled, isPollsEnabled }: IProps) {title = 'chat.tabs.closedCaptions';} else if (fileSharingTabEnabled && focusedTab === ChatTabs.FILE_SHARING) {title = 'chat.tabs.fileSharing';+ } else {+ // If the focused tab is not enabled, don't render the header.+ // This should not happen in normal circumstances since Chat.tsx already checks+ // if any tabs are available before rendering.+ return null;}return (diff --git a/react/features/chat/components/web/DisplayNameForm.tsx b/react/features/chat/components/web/DisplayNameForm.tsxindex 84bf02e0fe..0bdffb5a4d 100644--- a/react/features/chat/components/web/DisplayNameForm.tsx+++ b/react/features/chat/components/web/DisplayNameForm.tsx@@ -25,6 +25,16 @@ interface IProps extends WithTranslation {*/isCCTabEnabled: boolean;+ /**+ * Whether chat is disabled.+ */+ isChatDisabled: boolean;++ /**+ * Whether file sharing is enabled.+ */+ isFileSharingEnabled: boolean;+/*** Whether the polls feature is enabled or not.*/@@ -74,17 +84,30 @@ class DisplayNameForm extends Component<IProps, IState> {* @returns {ReactElement}*/override render() {- const { isCCTabEnabled, isPollsEnabled, t } = this.props;+ const { isCCTabEnabled, isChatDisabled, isFileSharingEnabled, isPollsEnabled, t } = this.props;++ // Build array of enabled feature names (translated).+ const features = [+ !isChatDisabled ? t('chat.nickname.featureChat') : '',+ isPollsEnabled ? t('chat.nickname.featurePolls') : '',+ isFileSharingEnabled ? t('chat.nickname.featureFileSharing') : '',+ isCCTabEnabled ? t('chat.nickname.featureClosedCaptions') : ''+ ].filter(Boolean);++ // Return null if no features available - component won't render.+ if (features.length === 0) {+ return null;+ }- let title = 'chat.nickname.title';+ // Build translation arguments dynamically: { feature1: "chat", feature2: "polls", ... }+ const translationArgs = features.reduce((acc, feature, index) => {+ acc[`feature${index + 1}`] = feature;- if (isCCTabEnabled && isPollsEnabled) {- title = 'chat.nickname.titleWithPollsAndCC';- } else if (isCCTabEnabled) {- title = 'chat.nickname.titleWithCC';- } else if (isPollsEnabled) {- title = 'chat.nickname.titleWithPolls';- }+ return acc;+ }, {} as Record<string, string>);++ // Use dynamic translation key: "titleWith1Features", "titleWith2Features", etc.+ const title = t(`chat.nickname.titleWith${features.length}Features`, translationArgs);return (<div id = 'nickname'>diff --git a/react/features/chat/functions.ts b/react/features/chat/functions.tsindex ff74630cf7..f214a84d9b 100644--- a/react/features/chat/functions.ts+++ b/react/features/chat/functions.ts@@ -12,11 +12,14 @@ import { isJwtFeatureEnabled } from '../base/jwt/functions';import { getParticipantById, isPrivateChatEnabled } from '../base/participants/functions';import { IParticipant } from '../base/participants/types';import { escapeRegexp } from '../base/util/helpers';+import { arePollsDisabled } from '../conference/functions.any';+import { isFileSharingEnabled } from '../file-sharing/functions.any';import { getParticipantsPaneWidth } from '../participants-pane/functions';+import { isCCTabEnabled } from '../subtitles/functions.any';import { VIDEO_SPACE_MIN_SIZE } from '../video-layout/constants';import { IVisitorChatParticipant } from '../visitors/types';-import { MESSAGE_TYPE_ERROR, MESSAGE_TYPE_LOCAL, TIMESTAMP_FORMAT } from './constants';+import { ChatTabs, MESSAGE_TYPE_ERROR, MESSAGE_TYPE_LOCAL, TIMESTAMP_FORMAT } from './constants';import { IMessage } from './types';/**@@ -153,6 +156,53 @@ export function areSmileysDisabled(state: IReduxState) {return disableChatSmileys;}+/**+ * Returns whether the chat feature is disabled.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {boolean} True if chat is disabled, false otherwise.+ */+export function isChatDisabled(state: IReduxState): boolean {+ return Boolean(state['features/base/config']?.disableChat);+}++/**+ * Gets the default focused tab based on what features are enabled.+ * Returns the first available tab in priority order: CHAT -> POLLS -> FILE_SHARING -> CLOSED_CAPTIONS.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {ChatTabs | undefined} The default focused tab.+ */+export function getDefaultFocusedTab(state: IReduxState): ChatTabs | undefined {+ if (!isChatDisabled(state)) {+ return ChatTabs.CHAT;+ }++ if (!arePollsDisabled(state)) {+ return ChatTabs.POLLS;+ }++ if (isFileSharingEnabled(state)) {+ return ChatTabs.FILE_SHARING;+ }++ if (isCCTabEnabled(state)) {+ return ChatTabs.CLOSED_CAPTIONS;+ }++ return undefined;+}++/**+ * Returns the currently focused tab or the default focused tab if none is set.+ *+ * @param {IReduxState} state - The redux state.+ * @returns {ChatTabs | undefined} The focused tab or undefined if no tabs are available.+ */+export function getFocusedTab(state: IReduxState): ChatTabs | undefined {+ return state['features/chat'].focusedTab || getDefaultFocusedTab(state);+}+/*** Returns the timestamp to display for the message.*diff --git a/react/features/chat/hooks.web.ts b/react/features/chat/hooks.web.tsnew file mode 100644index 0000000000..f912d02179--- /dev/null+++ b/react/features/chat/hooks.web.ts@@ -0,0 +1,23 @@+import { useSelector } from 'react-redux';++import ChatButton from './components/web/ChatButton';+import { isChatDisabled } from './functions';++const chat = {+ key: 'chat',+ Content: ChatButton,+ group: 2+};++/**+ * A hook that returns the chat button if chat is not disabled.+ *+ * @returns {Object | undefined} - The chat button object or undefined.+ */+export function useChatButton() {+ const _isChatDisabled = useSelector(isChatDisabled);++ if (!_isChatDisabled) {+ return chat;+ }+}diff --git a/react/features/chat/middleware.ts b/react/features/chat/middleware.tsindex deedbdd47d..b44b1f7496 100644--- a/react/features/chat/middleware.ts+++ b/react/features/chat/middleware.ts@@ -25,6 +25,8 @@ import { IParticipant } from '../base/participants/types';import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';import StateListenerRegistry from '../base/redux/StateListenerRegistry';import { playSound, registerSound, unregisterSound } from '../base/sounds/actions';+import { arePollsDisabled } from '../conference/functions.any';+import { isFileSharingEnabled } from '../file-sharing/functions.any';import { addGif } from '../gifs/actions';import { extractGifURL, getGifDisplayMode, isGifEnabled, isGifMessage } from '../gifs/function.any';import { showMessageNotification } from '../notifications/actions';@@ -34,6 +36,7 @@ import { ADD_REACTION_MESSAGE } from '../reactions/actionTypes';import { pushReactions } from '../reactions/actions.any';import { ENDPOINT_REACTION_NAME } from '../reactions/constants';import { getReactionMessageFromBuffer, isReactionsEnabled } from '../reactions/functions.any';+import { isCCTabEnabled } from '../subtitles/functions.any';import { showToolbox } from '../toolbox/actions';import { getDisplayName } from '../visitors/functions';@@ -66,7 +69,9 @@ import {} from './constants';import {getDisplayNameSuffix,+ getFocusedTab,getUnreadCount,+ isChatDisabled,isSendGroupChatDisabled,isVisitorChatParticipant} from './functions';@@ -181,23 +186,28 @@ MiddlewareRegistry.register(store => next => action => {case SET_FOCUSED_TAB:case OPEN_CHAT: {- const focusedTab = action.tabId || getState()['features/chat'].focusedTab;+ const state = store.getState();+ const focusedTab = action.tabId || getFocusedTab(state);if (focusedTab === ChatTabs.CHAT) {+ // Don't allow opening chat if it's disabled AND user is trying to open the CHAT tab.+ if (isChatDisabled(state)) {+ return next(action);+ }unreadCount = 0;if (typeof APP !== 'undefined') {APP.API.notifyChatUpdated(unreadCount, true);}- const { privateMessageRecipient } = store.getState()['features/chat'];+ const { privateMessageRecipient } = state['features/chat'];if (- isSendGroupChatDisabled(store.getState())+ isSendGroupChatDisabled(state)&& privateMessageRecipient&& !action.participant) {- const participant = getParticipantById(store.getState(), privateMessageRecipient.id);+ const participant = getParticipantById(state, privateMessageRecipient.id);if (participant) {action.participant = participant;@@ -207,7 +217,21 @@ MiddlewareRegistry.register(store => next => action => {}}} else if (focusedTab === ChatTabs.POLLS) {+ // Don't allow opening chat panel if polls are disabled AND user is trying to open the POLLS tab.+ if (arePollsDisabled(state)) {+ return next(action);+ }dispatch(resetUnreadPollsCount());++ // Don't allow opening chat panel if file sharing is disabled AND user is trying to open the+ // FILE_SHARING tab.+ } else if (focusedTab === ChatTabs.FILE_SHARING && !isFileSharingEnabled(state)) {+ return next(action);++ // Don't allow opening chat panel if closed captions are disabled AND user is trying to open the+ // CLOSED_CAPTIONS tab.+ } else if (focusedTab === ChatTabs.CLOSED_CAPTIONS && !isCCTabEnabled(state)) {+ return next(action);}break;@@ -576,6 +600,11 @@ function _handleReceivedMessage({ dispatch, getState }: IStore,const { isOpen: isChatOpen } = state['features/chat'];const { soundsIncomingMessage: soundEnabled, userSelectedNotifications } = state['features/base/settings'];+ // Don't play sound or show notifications if chat is disabled.+ if (isChatDisabled(state)) {+ return;+ }+if (soundEnabled && shouldPlaySound && !isChatOpen) {dispatch(playSound(INCOMING_MSG_SOUND_ID));}diff --git a/react/features/chat/reducer.ts b/react/features/chat/reducer.tsindex 1380d6b513..4eae8f837a 100644--- a/react/features/chat/reducer.ts+++ b/react/features/chat/reducer.ts@@ -35,7 +35,7 @@ const DEFAULT_STATE = {privateMessageRecipient: undefined,lobbyMessageRecipient: undefined,isLobbyChatActive: false,- focusedTab: ChatTabs.CHAT,+ focusedTab: undefined,isResizing: false,width: {current: CHAT_SIZE,@@ -44,7 +44,7 @@ const DEFAULT_STATE = {};export interface IChatState {- focusedTab: ChatTabs;+ focusedTab?: ChatTabs;groupChatWithPermissions: boolean;isLobbyChatActive: boolean;isOpen: boolean;diff --git a/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsx b/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsxindex 98879726de..b2e1959c3c 100644--- a/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsx+++ b/react/features/mobile/navigation/components/chat/components/ChatAndPollsNavigator.tsx@@ -4,7 +4,6 @@ import { createMaterialTopTabNavigator } from '@react-navigation/material-top-taimport React from 'react';import { useDispatch, useSelector } from 'react-redux';-import { IReduxState } from '../../../../../app/types';import {getClientHeight,getClientWidth@@ -12,6 +11,7 @@ import {import { setFocusedTab } from '../../../../../chat/actions.any';import Chat from '../../../../../chat/components/native/Chat';import { ChatTabs } from '../../../../../chat/constants';+import { getFocusedTab } from '../../../../../chat/functions';import { resetUnreadPollsCount } from '../../../../../polls/actions';import PollsPane from '../../../../../polls/components/native/PollsPane';import { screen } from '../../../routes';@@ -23,8 +23,8 @@ const ChatAndPolls = () => {const clientHeight = useSelector(getClientHeight);const clientWidth = useSelector(getClientWidth);const dispatch = useDispatch();- const { focusedTab } = useSelector((state: IReduxState) => state['features/chat']);- const initialRouteName = focusedTab === ChatTabs.POLLS+ const currentFocusedTab = useSelector(getFocusedTab);+ const initialRouteName = currentFocusedTab === ChatTabs.POLLS? screen.conference.chatandpolls.tab.polls: screen.conference.chatandpolls.tab.chat;diff --git a/react/features/toolbox/hooks.web.ts b/react/features/toolbox/hooks.web.tsindex 86719d206d..69047440af 100644--- a/react/features/toolbox/hooks.web.ts+++ b/react/features/toolbox/hooks.web.ts@@ -13,7 +13,8 @@ import { raiseHand } from '../base/participants/actions';import { getLocalParticipant, hasRaisedHand } from '../base/participants/functions';import { isToggleCameraEnabled } from '../base/tracks/functions.web';import { toggleChat } from '../chat/actions.web';-import ChatButton from '../chat/components/web/ChatButton';+import { isChatDisabled } from '../chat/functions';+import { useChatButton } from '../chat/hooks.web';import { useEmbedButton } from '../embed-meeting/hooks';import { useEtherpadButton } from '../etherpad/hooks';import { useFeedbackButton } from '../feedback/hooks.web';@@ -93,12 +94,6 @@ const profile = {group: 1};-const chat = {- key: 'chat',- Content: ChatButton,- group: 2-};-const desktop = {key: 'desktop',Content: ShareDesktopButton,@@ -279,6 +274,7 @@ export function useToolboxButtons(const reactions = useReactionsButton();const participants = useParticipantPaneButton();const tileview = useTileViewButton();+ const chat = useChatButton();const cc = useClosedCaptionButton();const polls = usePollsButton();const filesharing = useFileSharingButton();@@ -366,6 +362,7 @@ export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {const _toolbarButtons = useSelector((state: IReduxState) => toolbarButtons || state['features/toolbox'].toolbarButtons);const chatOpen = useSelector((state: IReduxState) => state['features/chat'].isOpen);+ const _isChatDisabled = useSelector(isChatDisabled);const desktopSharingButtonDisabled = useSelector(isDesktopShareButtonDisabled);const desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();const fullScreen = useSelector((state: IReduxState) => state['features/toolbox'].fullScreen);@@ -383,6 +380,11 @@ export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {* @returns {void}*/function onToggleChat() {+ // Don't toggle chat if it's disabled.+ if (_isChatDisabled) {+ return false;+ }+sendAnalytics(createShortcutEvent('toggle.chat',ACTION_SHORTCUT_TRIGGERED,@@ -533,7 +535,7 @@ export const useKeyboardShortcuts = (toolbarButtons: Array<string>) => {exec: onToggleVideoQuality,helpDescription: 'toolbar.callQuality'},- isButtonEnabled('chat', _toolbarButtons) && {+ !_isChatDisabled && isButtonEnabled('chat', _toolbarButtons) && {character: 'C',exec: onToggleChat,helpDescription: 'keyboardShortcuts.toggleChat'diff --git a/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx b/react/features/video-menu/components/web/PrivateMessageMenuButton.tsxindex 9606b91545..881aeeee94 100644--- a/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx+++ b/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx@@ -11,6 +11,7 @@ import { getParticipantById } from '../../../base/participants/functions';import { IParticipant } from '../../../base/participants/types';import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';import { openChat } from '../../../chat/actions.web';+import { isChatDisabled } from '../../../chat/functions';import { isButtonEnabled } from '../../../toolbox/functions.web';import { NOTIFY_CLICK_MODE } from '../../../toolbox/types';import { IButtonProps } from '../../types';@@ -98,14 +99,14 @@ class PrivateMessageMenuButton extends Component<IProps> {* @returns {IProps}*/function _mapStateToProps(state: IReduxState, ownProps: any) {- const enabled = getFeatureFlag(state, CHAT_ENABLED, true);+ const enabled = getFeatureFlag(state, CHAT_ENABLED, true) && !isChatDisabled(state);const { visible = enabled } = ownProps;return {_participant: getParticipantById(state, ownProps.participantID),visible,- _hidden: typeof interfaceConfig !== 'undefined'- && (interfaceConfig.DISABLE_PRIVATE_MESSAGES || !isButtonEnabled('chat', state))+ _hidden: (typeof interfaceConfig !== 'undefined'+ && (interfaceConfig.DISABLE_PRIVATE_MESSAGES || !isButtonEnabled('chat', state))) || isChatDisabled(state)};}