浏览代码

fix(subject) Fix setting and broadcasting subject (#14807)

factor2
Horatiu Muresan 1年前
父节点
当前提交
befffa7e85
没有帐户链接到提交者的电子邮件

+ 1
- 1
react/features/app/actions.native.ts 查看文件

@@ -151,7 +151,7 @@ export function appNavigate(uri?: string, options: IReloadNowOptions = {}) {
151 151
         }
152 152
 
153 153
         dispatch(setLocationURL(locationURL));
154
-        dispatch(setConfig(config, locationURL));
154
+        dispatch(setConfig(config));
155 155
         dispatch(setRoom(room));
156 156
 
157 157
         if (!room) {

+ 1
- 1
react/features/app/actions.web.ts 查看文件

@@ -74,7 +74,7 @@ export function appNavigate(uri?: string) {
74 74
         const config = await loadConfig();
75 75
 
76 76
         dispatch(setLocationURL(locationURL));
77
-        dispatch(setConfig(config, locationURL));
77
+        dispatch(setConfig(config));
78 78
         dispatch(setRoom(room));
79 79
     };
80 80
 }

+ 3
- 3
react/features/base/conference/actions.any.ts 查看文件

@@ -984,12 +984,12 @@ export function setStartMutedPolicy(
984 984
  * @param {string} subject - The new subject.
985 985
  * @returns {void}
986 986
  */
987
-export function setSubject(subject: string | undefined) {
987
+export function setSubject(subject: string) {
988 988
     return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
989 989
         const { conference } = getState()['features/base/conference'];
990 990
 
991 991
         if (conference) {
992
-            conference.setSubject(subject || '');
992
+            conference.setSubject(subject);
993 993
         } else {
994 994
             dispatch({
995 995
                 type: SET_PENDING_SUBJECT_CHANGE,
@@ -1008,7 +1008,7 @@ export function setSubject(subject: string | undefined) {
1008 1008
  *     localSubject: string
1009 1009
  * }}
1010 1010
  */
1011
-export function setLocalSubject(localSubject: string | undefined) {
1011
+export function setLocalSubject(localSubject: string) {
1012 1012
     return {
1013 1013
         type: CONFERENCE_LOCAL_SUBJECT_CHANGED,
1014 1014
         localSubject

+ 3
- 9
react/features/base/conference/functions.ts 查看文件

@@ -185,18 +185,12 @@ export function forEachConference(
185 185
 export function getConferenceName(stateful: IStateful): string {
186 186
     const state = toState(stateful);
187 187
     const { callee } = state['features/base/jwt'];
188
-    const {
189
-        callDisplayName,
190
-        localSubject: configLocalSubject,
191
-        subject: configSubject
192
-    } = state['features/base/config'];
188
+    const { callDisplayName } = state['features/base/config'];
193 189
     const { localSubject, pendingSubjectChange, room, subject } = getConferenceState(state);
194 190
 
195
-    return (pendingSubjectChange
196
-        || configSubject
191
+    return (localSubject
192
+        || pendingSubjectChange
197 193
         || subject
198
-        || configLocalSubject
199
-        || localSubject
200 194
         || callDisplayName
201 195
         || callee?.name
202 196
         || (room && safeStartCase(safeDecodeURIComponent(room)))) ?? '';

+ 25
- 4
react/features/base/conference/reducer.ts 查看文件

@@ -3,6 +3,8 @@ import { AnyAction } from 'redux';
3 3
 import { FaceLandmarks } from '../../face-landmarks/types';
4 4
 import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../room-lock/constants';
5 5
 import { ISpeakerStats } from '../../speaker-stats/reducer';
6
+import { SET_CONFIG } from '../config/actionTypes';
7
+import { IConfig } from '../config/configType';
6 8
 import { CONNECTION_WILL_CONNECT, SET_LOCATION_URL } from '../connection/actionTypes';
7 9
 import { JitsiConferenceErrors } from '../lib-jitsi-meet';
8 10
 import ReducerRegistry from '../redux/ReducerRegistry';
@@ -278,11 +280,33 @@ ReducerRegistry.register<IConferenceState>('features/base/conference',
278 280
                 ...state,
279 281
                 metadata: action.metadata
280 282
             };
283
+
284
+        case SET_CONFIG:
285
+            return _setConfig(state, action);
281 286
         }
282 287
 
283 288
         return state;
284 289
     });
285 290
 
291
+/**
292
+ * Processes subject and local subject of the conference based on the new config.
293
+ *
294
+ * @param {Object} state - The Redux state of feature base/conference.
295
+ * @param {Action} action - The Redux action SET_CONFIG to reduce.
296
+ * @private
297
+ * @returns {Object} The new state after the reduction of the specified action.
298
+ */
299
+function _setConfig(state: IConferenceState, { config }: { config: IConfig; }) {
300
+    const { localSubject, subject } = config;
301
+
302
+    return {
303
+        ...state,
304
+        localSubject,
305
+        pendingSubjectChange: subject,
306
+        subject: undefined
307
+    };
308
+}
309
+
286 310
 /**
287 311
  * Reduces a specific Redux action AUTH_STATUS_CHANGED of the feature
288 312
  * base/conference.
@@ -606,10 +630,7 @@ function _setRoom(state: IConferenceState, action: AnyAction) {
606 630
      */
607 631
     return assign(state, {
608 632
         error: undefined,
609
-        localSubject: undefined,
610
-        pendingSubjectChange: undefined,
611
-        room,
612
-        subject: undefined
633
+        room
613 634
     });
614 635
 }
615 636
 

+ 43
- 41
react/features/base/config/actions.ts 查看文件

@@ -96,51 +96,53 @@ export function overwriteConfig(config: Object) {
96 96
  *
97 97
  * @param {Object} config - The configuration to be represented by the feature
98 98
  * base/config.
99
- * @param {URL} locationURL - The URL of the location which necessitated the
100
- * loading of a configuration.
101 99
  * @returns {Function}
102 100
  */
103
-export function setConfig(config: IConfig = {}, locationURL: URL | undefined) {
104
-    // Now that the loading of the config was successful override the values
105
-    // with the parameters passed in the hash part of the location URI.
106
-    // TODO We're still in the middle ground between old Web with config,
107
-    // and interfaceConfig used via global variables and new
108
-    // Web and mobile reading the respective values from the redux store.
109
-    // Only the config will be overridden on React Native, as the other
110
-    // globals will be undefined here. It's intentional - we do not care to
111
-    // override those configs yet.
112
-    locationURL
113
-        && setConfigFromURLParams(
114
-
115
-            // On Web the config also comes from the window.config global,
116
-            // but it is resolved in the loadConfig procedure.
117
-            config,
118
-            window.interfaceConfig,
119
-            locationURL);
120
-
121
-    let { bosh } = config;
122
-
123
-    if (bosh) {
124
-        // Normalize the BOSH URL.
125
-        if (bosh.startsWith('//')) {
126
-            // By default our config.js doesn't include the protocol.
127
-            bosh = `${locationURL?.protocol}${bosh}`;
128
-        } else if (bosh.startsWith('/')) {
129
-            // Handle relative URLs, which won't work on mobile.
130
-            const {
131
-                protocol,
132
-                host,
133
-                contextRoot
134
-            } = parseURIString(locationURL?.href);
135
-
136
-            bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;
101
+export function setConfig(config: IConfig = {}) {
102
+    return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
103
+        const { locationURL } = getState()['features/base/connection'];
104
+
105
+        // Now that the loading of the config was successful override the values
106
+        // with the parameters passed in the hash part of the location URI.
107
+        // TODO We're still in the middle ground between old Web with config,
108
+        // and interfaceConfig used via global variables and new
109
+        // Web and mobile reading the respective values from the redux store.
110
+        // Only the config will be overridden on React Native, as the other
111
+        // globals will be undefined here. It's intentional - we do not care to
112
+        // override those configs yet.
113
+        locationURL
114
+            && setConfigFromURLParams(
115
+
116
+                // On Web the config also comes from the window.config global,
117
+                // but it is resolved in the loadConfig procedure.
118
+                config,
119
+                window.interfaceConfig,
120
+                locationURL);
121
+
122
+        let { bosh } = config;
123
+
124
+        if (bosh) {
125
+            // Normalize the BOSH URL.
126
+            if (bosh.startsWith('//')) {
127
+                // By default our config.js doesn't include the protocol.
128
+                bosh = `${locationURL?.protocol}${bosh}`;
129
+            } else if (bosh.startsWith('/')) {
130
+                // Handle relative URLs, which won't work on mobile.
131
+                const {
132
+                    protocol,
133
+                    host,
134
+                    contextRoot
135
+                } = parseURIString(locationURL?.href);
136
+
137
+                bosh = `${protocol}//${host}${contextRoot || '/'}${bosh.substr(1)}`;
138
+            }
139
+            config.bosh = bosh;
137 140
         }
138
-        config.bosh = bosh;
139
-    }
140 141
 
141
-    return {
142
-        type: SET_CONFIG,
143
-        config
142
+        dispatch({
143
+            type: SET_CONFIG,
144
+            config
145
+        });
144 146
     };
145 147
 }
146 148
 

+ 1
- 4
react/features/prejoin/components/web/PrejoinApp.tsx 查看文件

@@ -50,9 +50,6 @@ export default class PrejoinApp extends BaseApp<Props> {
50 50
             ? store.getState()['features/base/settings']
51 51
             : { startWithAudioMuted: undefined,
52 52
                 startWithVideoMuted: undefined };
53
-        const { locationURL } = store
54
-            ? store.getState()['features/base/connection']
55
-            : { locationURL: undefined };
56 53
 
57 54
         dispatch?.(setConfig({
58 55
             prejoinConfig: {
@@ -60,7 +57,7 @@ export default class PrejoinApp extends BaseApp<Props> {
60 57
             },
61 58
             startWithAudioMuted,
62 59
             startWithVideoMuted
63
-        }, locationURL));
60
+        }));
64 61
 
65 62
         await dispatch?.(setupInitialDevices());
66 63
         const { tryCreateLocalTracks, errors } = createPrejoinTracks();

正在加载...
取消
保存