summary refs log tree commit diff
path: root/webclient/room
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
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')
-rw-r--r--webclient/room/room-controller.js13
-rw-r--r--webclient/room/room.html2
2 files changed, 9 insertions, 6 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;
         }
     }
diff --git a/webclient/room/room.html b/webclient/room/room.html
index 06ca63d2ea..c167819f15 100644
--- a/webclient/room/room.html
+++ b/webclient/room/room.html
@@ -44,7 +44,7 @@
                         <span ng-hide='msg.type !== "m.room.member"'>
                             {{ members[msg.user_id].displayname || msg.user_id }}
                             {{ {"join": "joined", "leave": "left", "invite": "invited"}[msg.content.membership] }}
-                            {{ msg.content.target_id || '' }}
+                            {{ msg.content.membership === "invite" ? (msg.state_key || '') : '' }}
                         </span>
                         <span ng-hide='msg.content.msgtype !== "m.emote"' ng-bind-html="'* ' + (members[msg.user_id].displayname || msg.user_id) + ' ' + msg.content.body | linky:'_blank'"/>
                         <span ng-hide='msg.content.msgtype !== "m.text"' ng-bind-html="((msg.content.msgtype === 'm.text') ? msg.content.body : '') | linky:'_blank'"/>