summary refs log tree commit diff
path: root/webclient
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2014-09-08 17:27:51 -0700
committerKegan Dougal <kegan@matrix.org>2014-09-08 17:27:51 -0700
commitf64cc237fc819116e78888fb1c542b1c8c08651a (patch)
tree963d00cb2c2cb3c6b033e1265fe6df447ca88bdf /webclient
parentlong topic is long. CSS support it (diff)
downloadsynapse-f64cc237fc819116e78888fb1c542b1c8c08651a.tar.xz
Fixed bug which displayed an older room topic because it was being returned from /initialSync messages key. Check the ts of the event before clobbering state.
Diffstat (limited to 'webclient')
-rw-r--r--webclient/components/matrix/event-handler-service.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/webclient/components/matrix/event-handler-service.js b/webclient/components/matrix/event-handler-service.js
index a14e515999..8232e3b4b0 100644
--- a/webclient/components/matrix/event-handler-service.js
+++ b/webclient/components/matrix/event-handler-service.js
@@ -150,10 +150,22 @@ angular.module('eventHandlerService', [])
     };
     
     var handleRoomTopic = function(event, isLiveEvent) {
-        console.log("handleRoomTopic " + isLiveEvent);
+        console.log("handleRoomTopic live="+isLiveEvent);
 
         initRoom(event.room_id);
 
+        // live events always update, but non-live events only update if the
+        // ts is later.
+        if (!isLiveEvent) {
+            var eventTs = event.ts;
+            var storedEvent = $rootScope.events.rooms[event.room_id][event.type];
+            if (storedEvent) {
+                if (storedEvent.ts > eventTs) {
+                    // ignore it, we have a newer one already.
+                    return;
+                }
+            }
+        }
         $rootScope.events.rooms[event.room_id][event.type] = event;
     };