summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-10-30 10:05:43 +0000
committerKegan Dougal <kegan@matrix.org>2014-10-30 10:05:43 +0000
commitb4b492824ebca35fe606ff5abccee576f4cd6d22 (patch)
tree25f44ce171a6e235cdee920a44bfde0392581144 /webclient/components
parentSYWEB-48: Better regex for binging on usernames. (diff)
downloadsynapse-b4b492824ebca35fe606ff5abccee576f4cd6d22.tar.xz
SYWEB-112: Use the right user ID when determining invites for display on the recents list.
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/matrix-filter.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/webclient/components/matrix/matrix-filter.js b/webclient/components/matrix/matrix-filter.js
index e6f2acc5fd..3d64a569a1 100644
--- a/webclient/components/matrix/matrix-filter.js
+++ b/webclient/components/matrix/matrix-filter.js
@@ -47,7 +47,6 @@ angular.module('matrixFilter', [])
             else if (room.members && !isPublicRoom) {    // Do not rename public room
             
                 var user_id = matrixService.config().user_id;
-
                 // Else, build the name from its users
                 // Limit the room renaming to 1:1 room
                 if (2 === Object.keys(room.members).length) {
@@ -65,8 +64,16 @@ angular.module('matrixFilter', [])
                     
                     var otherUserId;
 
-                    if (Object.keys(room.members)[0] && Object.keys(room.members)[0] !== user_id) {
+                    if (Object.keys(room.members)[0]) {
                         otherUserId = Object.keys(room.members)[0];
+                        // this could be an invite event (from event stream)
+                        if (otherUserId === user_id && 
+                                room.members[user_id].content.membership === "invite") {
+                            // this is us being invited to this room, so the
+                            // *user_id* is the other user ID and not the state
+                            // key.
+                            otherUserId = room.members[user_id].user_id;
+                        }
                     }
                     else {
                         // it's got to be an invite, or failing that a self-chat;