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
fix(subject) Fix setting and broadcasting subject (#14807)
Horatiu Muresanbefffa7e8528
diff --git a/react/features/app/actions.native.ts b/react/features/app/actions.native.tsindex 1af9a36f9d..23ef235c14 100644--- a/react/features/app/actions.native.ts+++ b/react/features/app/actions.native.ts@@ -151,7 +151,7 @@ export function appNavigate(uri?: string, options: IReloadNowOptions = {}) {}dispatch(setLocationURL(locationURL));- dispatch(setConfig(config, locationURL));+ dispatch(setConfig(config));dispatch(setRoom(room));if (!room) {diff --git a/react/features/app/actions.web.ts b/react/features/app/actions.web.tsindex 9c482a33ba..476b4148f0 100644--- a/react/features/app/actions.web.ts+++ b/react/features/app/actions.web.ts@@ -74,7 +74,7 @@ export function appNavigate(uri?: string) {const config = await loadConfig();dispatch(setLocationURL(locationURL));- dispatch(setConfig(config, locationURL));+ dispatch(setConfig(config));dispatch(setRoom(room));};}diff --git a/react/features/base/conference/actions.any.ts b/react/features/base/conference/actions.any.tsindex 7a80420843..ec53175e96 100644--- a/react/features/base/conference/actions.any.ts+++ b/react/features/base/conference/actions.any.ts@@ -984,12 +984,12 @@ export function setStartMutedPolicy(* @param {string} subject - The new subject.* @returns {void}*/-export function setSubject(subject: string | undefined) {+export function setSubject(subject: string) {return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {const { conference } = getState()['features/base/conference'];if (conference) {- conference.setSubject(subject || '');+ conference.setSubject(subject);} else {dispatch({type: SET_PENDING_SUBJECT_CHANGE,@@ -1008,7 +1008,7 @@ export function setSubject(subject: string | undefined) {* localSubject: string* }}*/-export function setLocalSubject(localSubject: string | undefined) {+export function setLocalSubject(localSubject: string) {return {type: CONFERENCE_LOCAL_SUBJECT_CHANGED,localSubjectdiff --git a/react/features/base/conference/functions.ts b/react/features/base/conference/functions.tsindex 37801e2faf..7c8f579b37 100644--- a/react/features/base/conference/functions.ts+++ b/react/features/base/conference/functions.ts@@ -185,18 +185,12 @@ export function forEachConference(export function getConferenceName(stateful: IStateful): string {const state = toState(stateful);const { callee } = state['features/base/jwt'];- const {- callDisplayName,- localSubject: configLocalSubject,- subject: configSubject- } = state['features/base/config'];+ const { callDisplayName } = state['features/base/config'];const { localSubject, pendingSubjectChange, room, subject } = getConferenceState(state);- return (pendingSubjectChange- || configSubject+ return (localSubject+ || pendingSubjectChange|| subject- || configLocalSubject- || localSubject|| callDisplayName|| callee?.name|| (room && safeStartCase(safeDecodeURIComponent(room)))) ?? '';diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.tsindex db1b3183cb..c35491a1ee 100644--- a/react/features/base/conference/reducer.ts+++ b/react/features/base/conference/reducer.ts@@ -3,6 +3,8 @@ import { AnyAction } from 'redux';import { FaceLandmarks } from '../../face-landmarks/types';import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../room-lock/constants';import { ISpeakerStats } from '../../speaker-stats/reducer';+import { SET_CONFIG } from '../config/actionTypes';+import { IConfig } from '../config/configType';import { CONNECTION_WILL_CONNECT, SET_LOCATION_URL } from '../connection/actionTypes';import { JitsiConferenceErrors } from '../lib-jitsi-meet';import ReducerRegistry from '../redux/ReducerRegistry';@@ -278,11 +280,33 @@ ReducerRegistry.register<IConferenceState>('features/base/conference',...state,metadata: action.metadata};++ case SET_CONFIG:+ return _setConfig(state, action);}return state;});+/**+ * Processes subject and local subject of the conference based on the new config.+ *+ * @param {Object} state - The Redux state of feature base/conference.+ * @param {Action} action - The Redux action SET_CONFIG to reduce.+ * @private+ * @returns {Object} The new state after the reduction of the specified action.+ */+function _setConfig(state: IConferenceState, { config }: { config: IConfig; }) {+ const { localSubject, subject } = config;++ return {+ ...state,+ localSubject,+ pendingSubjectChange: subject,+ subject: undefined+ };+}+/*** Reduces a specific Redux action AUTH_STATUS_CHANGED of the feature* base/conference.@@ -606,10 +630,7 @@ function _setRoom(state: IConferenceState, action: AnyAction) {*/return assign(state, {error: undefined,- localSubject: undefined,- pendingSubjectChange: undefined,- room,- subject: undefined+ room});}diff --git a/react/features/base/config/actions.ts b/react/features/base/config/actions.tsindex 643fe96b3e..59020bb0ec 100644--- a/react/features/base/config/actions.ts+++ b/react/features/base/config/actions.ts@@ -96,51 +96,53 @@ export function overwriteConfig(config: Object) {** @param {Object} config - The configuration to be represented by the feature* base/config.- * @param {URL} locationURL - The URL of the location which necessitated the- * loading of a configuration.* @returns {Function}*/-export function setConfig(config: IConfig = {}, locationURL: URL | undefined) {- // Now that the loading of the config was successful override the values- // with the parameters passed in the hash part of the location URI.- // TODO We're still in the middle ground between old Web with config,- // and interfaceConfig used via global variables and new- // Web and mobile reading the respective values from the redux store.- // Only the config will be overridden on React Native, as the other- // globals will be undefined here. It's intentional - we do not care to- // override those configs yet.- locationURL- && setConfigFromURLParams(-- // On Web the config also comes from the window.config global,- // but it is resolved in the loadConfig procedure.- config,- window.interfaceConfig,- locationURL);-- let { bosh } = config;-- if (bosh) {- // Normalize the BOSH URL.- if (bosh.startsWith('//')) {- // By default our config.js doesn't include the protocol.- bosh = `${locationURL?.protocol}${bosh}`;- } else if (bosh.startsWith('/')) {- // Handle relative URLs, which won't work on mobile.- const {- protocol,- host,- contextRoot- } = parseURIString(locationURL?.href);-- bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;+export function setConfig(config: IConfig = {}) {+ return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {+ const { locationURL } = getState()['features/base/connection'];++ // Now that the loading of the config was successful override the values+ // with the parameters passed in the hash part of the location URI.+ // TODO We're still in the middle ground between old Web with config,+ // and interfaceConfig used via global variables and new+ // Web and mobile reading the respective values from the redux store.+ // Only the config will be overridden on React Native, as the other+ // globals will be undefined here. It's intentional - we do not care to+ // override those configs yet.+ locationURL+ && setConfigFromURLParams(++ // On Web the config also comes from the window.config global,+ // but it is resolved in the loadConfig procedure.+ config,+ window.interfaceConfig,+ locationURL);++ let { bosh } = config;++ if (bosh) {+ // Normalize the BOSH URL.+ if (bosh.startsWith('//')) {+ // By default our config.js doesn't include the protocol.+ bosh = `${locationURL?.protocol}${bosh}`;+ } else if (bosh.startsWith('/')) {+ // Handle relative URLs, which won't work on mobile.+ const {+ protocol,+ host,+ contextRoot+ } = parseURIString(locationURL?.href);++ bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;+ }+ config.bosh = bosh;}- config.bosh = bosh;- }- return {- type: SET_CONFIG,- config+ dispatch({+ type: SET_CONFIG,+ config+ });};}diff --git a/react/features/prejoin/components/web/PrejoinApp.tsx b/react/features/prejoin/components/web/PrejoinApp.tsxindex 899592ae2d..7aaa5d592d 100644--- a/react/features/prejoin/components/web/PrejoinApp.tsx+++ b/react/features/prejoin/components/web/PrejoinApp.tsx@@ -50,9 +50,6 @@ export default class PrejoinApp extends BaseApp<Props> {? store.getState()['features/base/settings']: { startWithAudioMuted: undefined,startWithVideoMuted: undefined };- const { locationURL } = store- ? store.getState()['features/base/connection']- : { locationURL: undefined };dispatch?.(setConfig({prejoinConfig: {@@ -60,7 +57,7 @@ export default class PrejoinApp extends BaseApp<Props> {},startWithAudioMuted,startWithVideoMuted- }, locationURL));+ }));await dispatch?.(setupInitialDevices());const { tryCreateLocalTracks, errors } = createPrejoinTracks();