mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-01 04:09:07 +01:00
Move typing notifs to an "emphermal" event list on the room object
This commit is contained in:
parent
cc42d3f907
commit
722b65f461
2 changed files with 9 additions and 7 deletions
|
@ -44,12 +44,12 @@ class RoomSyncResult(collections.namedtuple("RoomSyncResult", [
|
||||||
"events",
|
"events",
|
||||||
"state",
|
"state",
|
||||||
"prev_batch",
|
"prev_batch",
|
||||||
"typing",
|
"ephemeral",
|
||||||
])):
|
])):
|
||||||
__slots__ = []
|
__slots__ = []
|
||||||
|
|
||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
return bool(self.events or self.state or self.typing)
|
return bool(self.events or self.state or self.ephemeral)
|
||||||
|
|
||||||
|
|
||||||
class SyncResult(collections.namedtuple("SyncResult", [
|
class SyncResult(collections.namedtuple("SyncResult", [
|
||||||
|
@ -180,7 +180,7 @@ class SyncHandler(BaseHandler):
|
||||||
prev_batch=prev_batch_token,
|
prev_batch=prev_batch_token,
|
||||||
state=current_state_events,
|
state=current_state_events,
|
||||||
limited=True,
|
limited=True,
|
||||||
typing=None,
|
ephemeral=[],
|
||||||
))
|
))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -214,7 +214,9 @@ class SyncHandler(BaseHandler):
|
||||||
)
|
)
|
||||||
now_token = now_token.copy_and_replace("typing_key", typing_key)
|
now_token = now_token.copy_and_replace("typing_key", typing_key)
|
||||||
|
|
||||||
typing_by_room = {event["room_id"]: event for event in typing}
|
typing_by_room = {event["room_id"]: [event] for event in typing}
|
||||||
|
for event in typing:
|
||||||
|
event.pop("room_id")
|
||||||
logger.debug("Typing %r", typing_by_room)
|
logger.debug("Typing %r", typing_by_room)
|
||||||
|
|
||||||
rm_handler = self.hs.get_handlers().room_member_handler
|
rm_handler = self.hs.get_handlers().room_member_handler
|
||||||
|
@ -256,7 +258,7 @@ class SyncHandler(BaseHandler):
|
||||||
prev_batch=prev_batch,
|
prev_batch=prev_batch,
|
||||||
state=state,
|
state=state,
|
||||||
limited=False,
|
limited=False,
|
||||||
typing=typing_by_room.get(room_id, None)
|
ephemeral=typing_by_room.get(room_id, [])
|
||||||
)
|
)
|
||||||
if room_sync:
|
if room_sync:
|
||||||
rooms.append(room_sync)
|
rooms.append(room_sync)
|
||||||
|
|
|
@ -66,6 +66,7 @@ class SyncRestServlet(RestServlet):
|
||||||
}
|
}
|
||||||
"state": [] // list of EventIDs updating the current state to
|
"state": [] // list of EventIDs updating the current state to
|
||||||
// be what it should be at the end of the batch.
|
// be what it should be at the end of the batch.
|
||||||
|
"ephemeral": []
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
@ -188,9 +189,8 @@ class SyncRestServlet(RestServlet):
|
||||||
"state": state_event_ids,
|
"state": state_event_ids,
|
||||||
"limited": room.limited,
|
"limited": room.limited,
|
||||||
"published": room.published,
|
"published": room.published,
|
||||||
|
"ephemeral": room.ephemeral,
|
||||||
}
|
}
|
||||||
if room.typing is not None:
|
|
||||||
result["typing"] = room.typing
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue