Переглянути джерело

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 роки тому
джерело
коміт
929622b27c
1 змінених файлів з 17 додано та 3 видалено
  1. 17
    3
      react/features/base/conference/middleware.js

+ 17
- 3
react/features/base/conference/middleware.js Переглянути файл

16
     getLocalParticipant,
16
     getLocalParticipant,
17
     getParticipantById,
17
     getParticipantById,
18
     getPinnedParticipant,
18
     getPinnedParticipant,
19
+    PARTICIPANT_ROLE,
19
     PARTICIPANT_UPDATED,
20
     PARTICIPANT_UPDATED,
20
     PIN_PARTICIPANT
21
     PIN_PARTICIPANT
21
 } from '../participants';
22
 } from '../participants';
602
  * @private
603
  * @private
603
  * @returns {Object} The value returned by {@code next(action)}.
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
     const { conference } = getState()['features/base/conference'];
607
     const { conference } = getState()['features/base/conference'];
607
     const { participant } = action;
608
     const { participant } = action;
608
     const result = next(action);
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
     return result;
628
     return result;

Завантаження…
Відмінити
Зберегти