mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-17 01:23:53 +01:00
Fix bug where web client wold break trying to add the earliest token without having initialised the room if your first page of history contained only events which didn't call initRoom. Just call initRoom in handleMessages since we use it there rather than leaving it to the individual event handling methods.
This commit is contained in:
parent
ceec607e7f
commit
81d061e74e
1 changed files with 1 additions and 12 deletions
|
@ -71,8 +71,6 @@ angular.module('eventHandlerService', [])
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleRoomCreate = function(event, isLiveEvent) {
|
var handleRoomCreate = function(event, isLiveEvent) {
|
||||||
initRoom(event.room_id);
|
|
||||||
|
|
||||||
// For now, we do not use the event data. Simply signal it to the app controllers
|
// For now, we do not use the event data. Simply signal it to the app controllers
|
||||||
$rootScope.$broadcast(ROOM_CREATE_EVENT, event, isLiveEvent);
|
$rootScope.$broadcast(ROOM_CREATE_EVENT, event, isLiveEvent);
|
||||||
};
|
};
|
||||||
|
@ -82,8 +80,6 @@ angular.module('eventHandlerService', [])
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleMessage = function(event, isLiveEvent) {
|
var handleMessage = function(event, isLiveEvent) {
|
||||||
initRoom(event.room_id);
|
|
||||||
|
|
||||||
if (isLiveEvent) {
|
if (isLiveEvent) {
|
||||||
if (event.user_id === matrixService.config().user_id &&
|
if (event.user_id === matrixService.config().user_id &&
|
||||||
(event.content.msgtype === "m.text" || event.content.msgtype === "m.emote") ) {
|
(event.content.msgtype === "m.text" || event.content.msgtype === "m.emote") ) {
|
||||||
|
@ -114,8 +110,6 @@ angular.module('eventHandlerService', [])
|
||||||
};
|
};
|
||||||
|
|
||||||
var handleRoomMember = function(event, isLiveEvent, isStateEvent) {
|
var handleRoomMember = function(event, isLiveEvent, isStateEvent) {
|
||||||
initRoom(event.room_id);
|
|
||||||
|
|
||||||
// if the server is stupidly re-relaying a no-op join, discard it.
|
// if the server is stupidly re-relaying a no-op join, discard it.
|
||||||
if (event.prev_content &&
|
if (event.prev_content &&
|
||||||
event.content.membership === "join" &&
|
event.content.membership === "join" &&
|
||||||
|
@ -152,8 +146,6 @@ angular.module('eventHandlerService', [])
|
||||||
};
|
};
|
||||||
|
|
||||||
var handlePowerLevels = function(event, isLiveEvent) {
|
var handlePowerLevels = function(event, isLiveEvent) {
|
||||||
initRoom(event.room_id);
|
|
||||||
|
|
||||||
// Keep the latest data. Do not care of events that come when paginating back
|
// Keep the latest data. Do not care of events that come when paginating back
|
||||||
if (!$rootScope.events.rooms[event.room_id][event.type] || isLiveEvent) {
|
if (!$rootScope.events.rooms[event.room_id][event.type] || isLiveEvent) {
|
||||||
$rootScope.events.rooms[event.room_id][event.type] = event;
|
$rootScope.events.rooms[event.room_id][event.type] = event;
|
||||||
|
@ -164,8 +156,6 @@ angular.module('eventHandlerService', [])
|
||||||
var handleRoomName = function(event, isLiveEvent) {
|
var handleRoomName = function(event, isLiveEvent) {
|
||||||
console.log("handleRoomName " + isLiveEvent);
|
console.log("handleRoomName " + isLiveEvent);
|
||||||
|
|
||||||
initRoom(event.room_id);
|
|
||||||
|
|
||||||
$rootScope.events.rooms[event.room_id][event.type] = event;
|
$rootScope.events.rooms[event.room_id][event.type] = event;
|
||||||
$rootScope.$broadcast(NAME_EVENT, event, isLiveEvent);
|
$rootScope.$broadcast(NAME_EVENT, event, isLiveEvent);
|
||||||
};
|
};
|
||||||
|
@ -174,8 +164,6 @@ angular.module('eventHandlerService', [])
|
||||||
var handleRoomTopic = function(event, isLiveEvent, isStateEvent) {
|
var handleRoomTopic = function(event, isLiveEvent, isStateEvent) {
|
||||||
console.log("handleRoomTopic live="+isLiveEvent);
|
console.log("handleRoomTopic live="+isLiveEvent);
|
||||||
|
|
||||||
initRoom(event.room_id);
|
|
||||||
|
|
||||||
// Add topic changes as if they were a room message
|
// Add topic changes as if they were a room message
|
||||||
if (!isStateEvent) {
|
if (!isStateEvent) {
|
||||||
if (isLiveEvent) {
|
if (isLiveEvent) {
|
||||||
|
@ -316,6 +304,7 @@ angular.module('eventHandlerService', [])
|
||||||
|
|
||||||
// Handle messages from /initialSync or /messages
|
// Handle messages from /initialSync or /messages
|
||||||
handleRoomMessages: function(room_id, messages, isLiveEvents) {
|
handleRoomMessages: function(room_id, messages, isLiveEvents) {
|
||||||
|
initRoom(room_id);
|
||||||
this.handleEvents(messages.chunk, isLiveEvents);
|
this.handleEvents(messages.chunk, isLiveEvents);
|
||||||
|
|
||||||
// Store how far back we've paginated
|
// Store how far back we've paginated
|
||||||
|
|
Loading…
Reference in a new issue