Ver código fonte

fix(Avatar): Avatar to return the local avatar when jid is null

master
hristoterezov 8 anos atrás
pai
commit
84fd0531f6
1 arquivos alterados com 9 adições e 4 exclusões
  1. 9
    4
      modules/UI/avatar/Avatar.js

+ 9
- 4
modules/UI/avatar/Avatar.js Ver arquivo

@@ -1,4 +1,4 @@
1
-/* global MD5, config, interfaceConfig */
1
+/* global MD5, config, interfaceConfig, APP */
2 2
 
3 3
 let users = {};
4 4
 
@@ -10,6 +10,12 @@ export default {
10 10
      * @param val {string} value to be set
11 11
      */
12 12
     _setUserProp: function (id, prop, val) {
13
+        // FIXME: Fixes the issue with not be able to return avatar for the
14
+        // local user when the conference has been left. Maybe there is beter
15
+        // way to solve it.
16
+        if(APP.conference.isLocalId(id)) {
17
+            id = "local";
18
+        }
13 19
         if(!val || (users[id] && users[id][prop] === val))
14 20
             return;
15 21
         if(!users[id])
@@ -56,9 +62,8 @@ export default {
56 62
             return 'images/avatar2.png';
57 63
         }
58 64
 
59
-        if (!userId) {
60
-            console.error("Get avatar - id is undefined");
61
-            return null;
65
+        if (!userId || APP.conference.isLocalId(userId)) {
66
+            userId = "local";
62 67
         }
63 68
 
64 69
         let avatarId = null;

Carregando…
Cancelar
Salvar