Bläddra i källkod

fix: Fixes setting subject from url.

There are occasions when role to moderator can change a little bit after joining the room, and initial try to set subject will silently be ignored if not moderator.
master
damencho 5 år sedan
förälder
incheckning
929622b27c
1 ändrade filer med 17 tillägg och 3 borttagningar
  1. 17
    3
      react/features/base/conference/middleware.js

+ 17
- 3
react/features/base/conference/middleware.js Visa fil

@@ -16,6 +16,7 @@ import {
16 16
     getLocalParticipant,
17 17
     getParticipantById,
18 18
     getPinnedParticipant,
19
+    PARTICIPANT_ROLE,
19 20
     PARTICIPANT_UPDATED,
20 21
     PIN_PARTICIPANT
21 22
 } from '../participants';
@@ -602,13 +603,26 @@ function _trackAddedOrRemoved(store, next, action) {
602 603
  * @private
603 604
  * @returns {Object} The value returned by {@code next(action)}.
604 605
  */
605
-function _updateLocalParticipantInConference({ getState }, next, action) {
606
+function _updateLocalParticipantInConference({ dispatch, getState }, next, action) {
606 607
     const { conference } = getState()['features/base/conference'];
607 608
     const { participant } = action;
608 609
     const result = next(action);
609 610
 
610
-    if (conference && participant.local && 'name' in participant) {
611
-        conference.setDisplayName(participant.name);
611
+    const localParticipant = getLocalParticipant(getState);
612
+
613
+    if (conference && participant.id === localParticipant.id) {
614
+        if ('name' in participant) {
615
+            conference.setDisplayName(participant.name);
616
+        }
617
+
618
+        const { pendingSubjectChange, subject } = getState()['features/base/conference'];
619
+        const isModerator = participant.role === PARTICIPANT_ROLE.MODERATOR;
620
+
621
+        // when local user role is updated to moderator and we have a pending subject change
622
+        // which was not reflected we need to set it (the first time we tried was before becoming moderator)
623
+        if (isModerator && pendingSubjectChange !== subject) {
624
+            dispatch(setSubject(pendingSubjectChange));
625
+        }
612 626
     }
613 627
 
614 628
     return result;

Laddar…
Avbryt
Spara