Przeglądaj źródła

fix: honor updates of the local user role before conference join

When the prosody setting has muc_allowners, everyone joins as a
moderator. In this case, the local user will not be set as a
moderator in the redux store as the USER_ROLE_CHANGE event will
trigger with the local user id before the redux store has set
the actual local user id--something that happens on
CONFERENCE_JOINED. The fix is to explicitly signal the local user
role has changed to the redux store, which follows the
implementation of pre-existing web logic.
j8
Leonard Kim 8 lat temu
rodzic
commit
a82bc1df64
2 zmienionych plików z 28 dodań i 8 usunięć
  1. 6
    1
      conference.js
  2. 22
    7
      react/features/base/participants/actions.js

+ 6
- 1
conference.js Wyświetl plik

@@ -37,6 +37,7 @@ import {
37 37
     isFatalJitsiConnectionError
38 38
 } from './react/features/base/lib-jitsi-meet';
39 39
 import {
40
+    localParticipantRoleChanged,
40 41
     participantJoined,
41 42
     participantLeft,
42 43
     participantRoleChanged,
@@ -1262,14 +1263,18 @@ export default {
1262 1263
 
1263 1264
 
1264 1265
         room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => {
1265
-            APP.store.dispatch(participantRoleChanged(id, role));
1266 1266
             if (this.isLocalId(id)) {
1267 1267
                 logger.info(`My role changed, new role: ${role}`);
1268
+
1269
+                APP.store.dispatch(localParticipantRoleChanged(role));
1270
+
1268 1271
                 if (this.isModerator !== room.isModerator()) {
1269 1272
                     this.isModerator = room.isModerator();
1270 1273
                     APP.UI.updateLocalRole(room.isModerator());
1271 1274
                 }
1272 1275
             } else {
1276
+                APP.store.dispatch(participantRoleChanged(id, role));
1277
+
1273 1278
                 let user = room.getParticipantById(id);
1274 1279
                 if (user) {
1275 1280
                     APP.UI.updateUserRole(user);

+ 22
- 7
react/features/base/participants/actions.js Wyświetl plik

@@ -29,15 +29,12 @@ export function dominantSpeakerChanged(id) {
29 29
 }
30 30
 
31 31
 /**
32
- * Action to signal that ID of local participant has changed. This happens when
33
- * local participant joins a new conference or quits one.
32
+ * Action to signal that the ID of local participant has changed. It happens
33
+ * when the local participant joins a new conference or leaves an existing
34
+ * conference.
34 35
  *
35 36
  * @param {string} id - New ID for local participant.
36
- * @returns {{
37
- *     type: PARTICIPANT_ID_CHANGED,
38
- *     newValue: string,
39
- *     oldValue: string
40
- * }}
37
+ * @returns {Function}
41 38
  */
42 39
 export function localParticipantIdChanged(id) {
43 40
     return (dispatch, getState) => {
@@ -69,6 +66,24 @@ export function localParticipantJoined(participant = {}) {
69 66
     });
70 67
 }
71 68
 
69
+/**
70
+ * Action to signal the role of the local participant has changed. It can happen
71
+ * when the participant has joined a conference, even before a non-default local
72
+ * id has been set, or after a moderator leaves.
73
+ *
74
+ * @param {string} role - The new role of the local participant.
75
+ * @returns {Function}
76
+ */
77
+export function localParticipantRoleChanged(role) {
78
+    return (dispatch, getState) => {
79
+        const participant = getLocalParticipant(getState);
80
+
81
+        if (participant) {
82
+            return dispatch(participantRoleChanged(participant.id, role));
83
+        }
84
+    };
85
+}
86
+
72 87
 /**
73 88
  * Action to update a participant's connection status.
74 89
  *

Ładowanie…
Anuluj
Zapisz