Browse Source

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

master
hristoterezov 8 years ago
parent
commit
84fd0531f6
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      modules/UI/avatar/Avatar.js

+ 9
- 4
modules/UI/avatar/Avatar.js View File

1
-/* global MD5, config, interfaceConfig */
1
+/* global MD5, config, interfaceConfig, APP */
2
 
2
 
3
 let users = {};
3
 let users = {};
4
 
4
 
10
      * @param val {string} value to be set
10
      * @param val {string} value to be set
11
      */
11
      */
12
     _setUserProp: function (id, prop, val) {
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
         if(!val || (users[id] && users[id][prop] === val))
19
         if(!val || (users[id] && users[id][prop] === val))
14
             return;
20
             return;
15
         if(!users[id])
21
         if(!users[id])
56
             return 'images/avatar2.png';
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
         let avatarId = null;
69
         let avatarId = null;

Loading…
Cancel
Save