mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-26 12:16:12 +00:00
Reenabled handle of room states events in initialSync but do not add them to the displayed messages in the room page.
Show the m.room.member events only when they come from room.messages (from initialSync of pagination) not from room.state.
This commit is contained in:
parent
c2afc6cd0a
commit
b099634ba1
@ -105,7 +105,7 @@ angular.module('eventHandlerService', [])
|
||||
$rootScope.$broadcast(MSG_EVENT, event, isLiveEvent);
|
||||
};
|
||||
|
||||
var handleRoomMember = function(event, isLiveEvent) {
|
||||
var handleRoomMember = function(event, isLiveEvent, isStateEvent) {
|
||||
initRoom(event.room_id);
|
||||
|
||||
// if the server is stupidly re-relaying a no-op join, discard it.
|
||||
@ -117,7 +117,10 @@ angular.module('eventHandlerService', [])
|
||||
}
|
||||
|
||||
// add membership changes as if they were a room message if something interesting changed
|
||||
if (event.content.prev !== event.content.membership) {
|
||||
// Exception: Do not do this if the event is a room state event because such events already come
|
||||
// as room messages events. Moreover, when they come as room messages events, they are relatively ordered
|
||||
// with other other room messages
|
||||
if (event.content.prev !== event.content.membership && !isStateEvent) {
|
||||
if (isLiveEvent) {
|
||||
$rootScope.events.rooms[event.room_id].messages.push(event);
|
||||
}
|
||||
@ -191,7 +194,7 @@ angular.module('eventHandlerService', [])
|
||||
CALL_EVENT: CALL_EVENT,
|
||||
NAME_EVENT: NAME_EVENT,
|
||||
|
||||
handleEvent: function(event, isLiveEvent) {
|
||||
handleEvent: function(event, isLiveEvent, isStateEvent) {
|
||||
// Avoid duplicated events
|
||||
// Needed for rooms where initialSync has not been done.
|
||||
// In this case, we do not know where to start pagination. So, it starts from the END
|
||||
@ -222,7 +225,7 @@ angular.module('eventHandlerService', [])
|
||||
handleMessage(event, isLiveEvent);
|
||||
break;
|
||||
case "m.room.member":
|
||||
handleRoomMember(event, isLiveEvent);
|
||||
handleRoomMember(event, isLiveEvent, isStateEvent);
|
||||
break;
|
||||
case "m.presence":
|
||||
handlePresence(event, isLiveEvent);
|
||||
@ -250,9 +253,9 @@ angular.module('eventHandlerService', [])
|
||||
|
||||
// isLiveEvents determines whether notifications should be shown, whether
|
||||
// messages get appended to the start/end of lists, etc.
|
||||
handleEvents: function(events, isLiveEvents) {
|
||||
handleEvents: function(events, isLiveEvents, isStateEvents) {
|
||||
for (var i=0; i<events.length; i++) {
|
||||
this.handleEvent(events[i], isLiveEvents);
|
||||
this.handleEvent(events[i], isLiveEvents, isStateEvents);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -113,15 +113,12 @@ angular.module('eventStreamService', [])
|
||||
for (var i = 0; i < rooms.length; ++i) {
|
||||
var room = rooms[i];
|
||||
|
||||
// console.log("got room: " + room.room_id);
|
||||
if ("state" in room) {
|
||||
//eventHandlerService.handleEvents(room.state, false);
|
||||
}
|
||||
|
||||
if ("messages" in room) {
|
||||
eventHandlerService.handleRoomMessages(room.room_id, room.messages, false);
|
||||
|
||||
console.log(room.messages.start + " - " + room.messages.end);
|
||||
}
|
||||
|
||||
if ("state" in room) {
|
||||
eventHandlerService.handleEvents(room.state, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user