Pārlūkot izejas kodu

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 gadus atpakaļ
vecāks
revīzija
a82bc1df64
2 mainītis faili ar 28 papildinājumiem un 8 dzēšanām
  1. 6
    1
      conference.js
  2. 22
    7
      react/features/base/participants/actions.js

+ 6
- 1
conference.js Parādīt failu

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

+ 22
- 7
react/features/base/participants/actions.js Parādīt failu

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
  * @param {string} id - New ID for local participant.
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
 export function localParticipantIdChanged(id) {
39
 export function localParticipantIdChanged(id) {
43
     return (dispatch, getState) => {
40
     return (dispatch, getState) => {
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
  * Action to update a participant's connection status.
88
  * Action to update a participant's connection status.
74
  *
89
  *

Notiek ielāde…
Atcelt
Saglabāt