mirror of
https://github.com/element-hq/synapse
synced 2024-09-11 20:35:10 +00:00
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.
This commit is contained in:
parent
ef2111099a
commit
f64cc237fc
1 changed files with 13 additions and 1 deletions
|
@ -150,10 +150,22 @@ angular.module('eventHandlerService', [])
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleRoomTopic = function(event, isLiveEvent) {
|
var handleRoomTopic = function(event, isLiveEvent) {
|
||||||
console.log("handleRoomTopic " + isLiveEvent);
|
console.log("handleRoomTopic live="+isLiveEvent);
|
||||||
|
|
||||||
initRoom(event.room_id);
|
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;
|
$rootScope.events.rooms[event.room_id][event.type] = event;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue