summary refs log tree commit diff
path: root/webclient/room/room-controller.js
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-08-26 10:24:47 +0100
committerKegan Dougal <kegan@matrix.org>2014-08-26 10:24:47 +0100
commit5796232cb19927612957db3fcf4b77cd383187a6 (patch)
tree18a3724608377c91d64eb2daab49d2d91a8cf4fe /webclient/room/room-controller.js
parentMerge branch 'develop' of github.com:matrix-org/synapse into client_server_ur... (diff)
downloadsynapse-5796232cb19927612957db3fcf4b77cd383187a6.tar.xz
Adjusted webclient to use new state paths. Updated membership msg template to actually show the person invited. Factored out common membership functions in matrix service.
Diffstat (limited to 'webclient/room/room-controller.js')
-rw-r--r--webclient/room/room-controller.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/webclient/room/room-controller.js b/webclient/room/room-controller.js
index 3311618825..f49deaa489 100644
--- a/webclient/room/room-controller.js
+++ b/webclient/room/room-controller.js
@@ -154,7 +154,10 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
     var updateMemberList = function(chunk) {
         if (chunk.room_id != $scope.room_id) return;
 
-        var isNewMember = !(chunk.target_user_id in $scope.members);
+        // set target_user_id to keep things clear
+        var target_user_id = chunk.state_key;
+
+        var isNewMember = !(target_user_id in $scope.members);
         if (isNewMember) {
             // FIXME: why are we copying these fields around inside chunk?
             if ("state" in chunk.content) {
@@ -172,7 +175,7 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
             if ("avatar_url" in chunk.content) {
                 chunk.avatar_url = chunk.content.avatar_url;
             }
-            $scope.members[chunk.target_user_id] = chunk;
+            $scope.members[target_user_id] = chunk;
 
 /*
             // Stale code for explicitly hammering the homeserver for every displayname & avatar_url
@@ -202,13 +205,13 @@ angular.module('RoomController', ['ngSanitize', 'mUtilities'])
             });
 */            
 
-            if (chunk.target_user_id in $rootScope.presence) {
-                updatePresence($rootScope.presence[chunk.target_user_id]);
+            if (target_user_id in $rootScope.presence) {
+                updatePresence($rootScope.presence[target_user_id]);
             }
         }
         else {
             // selectively update membership else it will nuke the picture and displayname too :/
-            var member = $scope.members[chunk.target_user_id];
+            var member = $scope.members[target_user_id];
             member.content.membership = chunk.content.membership;
         }
     }