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(external_api) set and cancel private chat through external API
hmuresan0a5910f0b3a0
diff --git a/modules/API/API.js b/modules/API/API.jsindex 4cdfaddd8b..a6dd4c2291 100644--- a/modules/API/API.js+++ b/modules/API/API.js@@ -14,7 +14,8 @@ import {} from '../../react/features/base/conference';import { parseJWTFromURLParams } from '../../react/features/base/jwt';import JitsiMeetJS, { JitsiRecordingConstants } from '../../react/features/base/lib-jitsi-meet';-import { pinParticipant } from '../../react/features/base/participants';+import { pinParticipant, getParticipantById } from '../../react/features/base/participants';+import { setPrivateMessageRecipient } from '../../react/features/chat/actions';import {processExternalDeviceRequest} from '../../react/features/device-selection/functions';@@ -330,6 +331,24 @@ function initCommands() {} else {logger.error('No recording or streaming session found');}+ },+ 'initiate-private-chat': participantId => {+ const state = APP.store.getState();+ const participant = getParticipantById(state, participantId);++ if (participant) {+ const { isOpen: isChatOpen } = state['features/chat'];++ if (!isChatOpen) {+ APP.UI.toggleChat();+ }+ APP.store.dispatch(setPrivateMessageRecipient(participant));+ } else {+ logger.error('No participant found for the given participantId');+ }+ },+ 'cancel-private-chat': () => {+ APP.store.dispatch(setPrivateMessageRecipient());}};transport.on('event', ({ data, name }) => {diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.jsindex bc0b11133d..d0fccb27a0 100644--- a/modules/API/external/external_api.js+++ b/modules/API/external/external_api.js@@ -28,11 +28,13 @@ const ALWAYS_ON_TOP_FILENAMES = [*/const commands = {avatarUrl: 'avatar-url',+ cancelPrivateChat: 'cancel-private-chat',displayName: 'display-name',e2eeKey: 'e2ee-key',email: 'email',toggleLobby: 'toggle-lobby',hangup: 'video-hangup',+ intiatePrivateChat: 'initiate-private-chat',muteEveryone: 'mute-everyone',password: 'password',pinParticipant: 'pin-participant',diff --git a/react/features/chat/middleware.js b/react/features/chat/middleware.jsindex 04719829cb..2e234c73d5 100644--- a/react/features/chat/middleware.js+++ b/react/features/chat/middleware.js@@ -19,7 +19,6 @@ import {import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';import { playSound, registerSound, unregisterSound } from '../base/sounds';import { showToolbox } from '../toolbox/actions';-import { isButtonEnabled } from '../toolbox/functions';import { SEND_MESSAGE, SET_PRIVATE_MESSAGE_RECIPIENT } from './actionTypes';import { addMessage, clearMessages, toggleChat } from './actions';@@ -152,10 +151,9 @@ StateListenerRegistry.register(* @returns {void}*/function _addChatMsgListener(conference, store) {- if ((typeof APP !== 'undefined' && !isButtonEnabled('chat'))- || store.getState()['features/base/config'].iAmRecorder) {- // We don't register anything on web if the chat button is not enabled in interfaceConfig- // or we are in iAmRecorder mode++ if (store.getState()['features/base/config'].iAmRecorder) {+ // We don't register anything on web if we are in iAmRecorder modereturn;}