Browse Source

fix(conference): Don't use this._room.

this._room should be used only by jitsi-meet-torture and for test purposes. Also this._room is assigned later than room. This may cause some issues, for example conference.getMyUserId() may return undefined while the user id is already available beacuse this._room hasn't been assigned yet.
master
Hristo Terezov 5 years ago
parent
commit
48285e8a2d
1 changed files with 10 additions and 13 deletions
  1. 10
    13
      conference.js

+ 10
- 13
conference.js View File

@@ -948,17 +948,15 @@ export default {
948 948
      * Returns the connection times stored in the library.
949 949
      */
950 950
     getConnectionTimes() {
951
-        return this._room.getConnectionTimes();
951
+        return room.getConnectionTimes();
952 952
     },
953 953
 
954 954
     // used by torture currently
955 955
     isJoined() {
956
-        return this._room
957
-            && this._room.isJoined();
956
+        return room && room.isJoined();
958 957
     },
959 958
     getConnectionState() {
960
-        return this._room
961
-            && this._room.getConnectionState();
959
+        return room && room.getConnectionState();
962 960
     },
963 961
 
964 962
     /**
@@ -967,8 +965,7 @@ export default {
967 965
      * P2P connection
968 966
      */
969 967
     getP2PConnectionState() {
970
-        return this._room
971
-            && this._room.getP2PConnectionState();
968
+        return room && room.getP2PConnectionState();
972 969
     },
973 970
 
974 971
     /**
@@ -977,7 +974,7 @@ export default {
977 974
      */
978 975
     _startP2P() {
979 976
         try {
980
-            this._room && this._room.startP2PSession();
977
+            room && room.startP2PSession();
981 978
         } catch (error) {
982 979
             logger.error('Start P2P failed', error);
983 980
             throw error;
@@ -990,7 +987,7 @@ export default {
990 987
      */
991 988
     _stopP2P() {
992 989
         try {
993
-            this._room && this._room.stopP2PSession();
990
+            room && room.stopP2PSession();
994 991
         } catch (error) {
995 992
             logger.error('Stop P2P failed', error);
996 993
             throw error;
@@ -1005,7 +1002,7 @@ export default {
1005 1002
      * false otherwise.
1006 1003
      */
1007 1004
     isConnectionInterrupted() {
1008
-        return this._room.isConnectionInterrupted();
1005
+        return room.isConnectionInterrupted();
1009 1006
     },
1010 1007
 
1011 1008
     /**
@@ -1066,7 +1063,7 @@ export default {
1066 1063
     },
1067 1064
 
1068 1065
     getMyUserId() {
1069
-        return this._room && this._room.myUserId();
1066
+        return room && room.myUserId();
1070 1067
     },
1071 1068
 
1072 1069
     /**
@@ -1089,7 +1086,7 @@ export default {
1089 1086
      * least one track.
1090 1087
      */
1091 1088
     getNumberOfParticipantsWithTracks() {
1092
-        return this._room.getParticipants()
1089
+        return room.getParticipants()
1093 1090
             .filter(p => p.getTracks().length > 0)
1094 1091
             .length;
1095 1092
     },
@@ -2206,7 +2203,7 @@ export default {
2206 2203
 
2207 2204
         if (config.requireDisplayName
2208 2205
                 && !APP.conference.getLocalDisplayName()
2209
-                && !this._room.isHidden()) {
2206
+                && !room.isHidden()) {
2210 2207
             APP.UI.promptDisplayName();
2211 2208
         }
2212 2209
 

Loading…
Cancel
Save