summary refs log tree commit diff
path: root/webclient
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-18 17:34:13 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-18 17:34:26 +0200
commit26dda48e50d414b28f9a81fede63b1dbb953f256 (patch)
treea481c8a1b4a2dc17b92b0591e17fe31cc7ade09b /webclient
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-26dda48e50d414b28f9a81fede63b1dbb953f256.tar.xz
SYWEB-14: BF: rooms invitations were not visible in recents after launching/refreshing the web page
Diffstat (limited to 'webclient')
-rw-r--r--webclient/components/matrix/event-handler-service.js17
-rw-r--r--webclient/components/matrix/event-stream-service.js4
-rw-r--r--webclient/recents/recents-filter.js4
3 files changed, 22 insertions, 3 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index c7be65720a..a6958dbad3 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -99,7 +99,7 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
     };
     reset();
 
-    var initRoom = function(room_id) {
+    var initRoom = function(room_id, room) {
         if (!(room_id in $rootScope.events.rooms)) {
             console.log("Creating new handler entry for " + room_id);
             $rootScope.events.rooms[room_id] = {
@@ -112,6 +112,17 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
                 }
             };
         }
+
+        if (room) {
+            // Report all other metadata of the room object (membership, inviter, visibility, ...)
+            for (var field in room) {
+                if (-1 === ["room_id", "messages", "state"].indexOf(field)) {
+                    console.log("#### " + field);
+                    $rootScope.events.rooms[room_id][field] = room[field];
+                }
+            }
+            $rootScope.events.rooms[room_id].membership = room.membership;
+        }
     };
 
     var resetRoomMessages = function(room_id) {
@@ -327,6 +338,10 @@ function(matrixService, $rootScope, $q, $timeout, mPresence) {
             reset();
             $rootScope.$broadcast(RESET_EVENT);
         },
+        
+        initRoom: function(room) {
+            initRoom(room.room_id, room);
+        },
     
         handleEvent: function(event, isLiveEvent, isStateEvent) {
 
diff --git a/webclient/components/matrix/event-stream-service.js b/webclient/components/matrix/event-stream-service.js
index 5af1ab2911..05469a3ded 100644
--- a/webclient/components/matrix/event-stream-service.js
+++ b/webclient/components/matrix/event-stream-service.js
@@ -112,6 +112,8 @@ angular.module('eventStreamService', [])
                 var rooms = response.data.rooms;
                 for (var i = 0; i < rooms.length; ++i) {
                     var room = rooms[i];
+                    
+                    eventHandlerService.initRoom(room);
 
                     if ("messages" in room) {
                         eventHandlerService.handleRoomMessages(room.room_id, room.messages, false);
@@ -120,8 +122,6 @@ angular.module('eventStreamService', [])
                     if ("state" in room) {
                         eventHandlerService.handleEvents(room.state, false, true);
                     }
-                    
-                    eventHandlerService.setRoomVisibility(room.room_id, room.visibility);
                 }
 
                 var presence = response.data.presence;
diff --git a/webclient/recents/recents-filter.js b/webclient/recents/recents-filter.js
index e8323f4a31..468a746b18 100644
--- a/webclient/recents/recents-filter.js
+++ b/webclient/recents/recents-filter.js
@@ -37,6 +37,10 @@ angular.module('RecentsController')
 
                 filtered.push(room);
             }
+            else if ("invite" === room.membership) {
+                // The only information we have about the room is that the user has been invited
+                filtered.push(room);
+            }
         });
 
         // And time sort them