0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 17:53:51 +01:00

Split receipt events up into one per room

This commit is contained in:
Erik Johnston 2015-07-08 11:36:05 +01:00
parent 87311d1b8c
commit d85ce8d89b

View file

@ -144,9 +144,8 @@ class ReceiptsHandler(BaseHandler):
event = {
"type": "m.receipt",
"content": {
room_id: result,
},
"room_id": room_id,
"content": result,
}
defer.returnValue([event])
@ -163,23 +162,19 @@ class ReceiptEventSource(object):
rooms = yield self.store.get_rooms_for_user(user.to_string())
rooms = [room.room_id for room in rooms]
content = {}
events = []
for room_id in rooms:
result = yield self.store.get_linearized_receipts_for_room(
content = yield self.store.get_linearized_receipts_for_room(
room_id, from_key, to_key
)
if result:
content[room_id] = result
if content:
events.append({
"type": "m.receipt",
"room_id": room_id,
"content": content,
})
if not content:
defer.returnValue(([], to_key))
event = {
"type": "m.receipt",
"content": content,
}
defer.returnValue(([event], to_key))
defer.returnValue((events, to_key))
def get_current_key(self, direction='f'):
return self.store.get_max_receipt_stream_id()
@ -195,20 +190,16 @@ class ReceiptEventSource(object):
rooms = yield self.store.get_rooms_for_user(user.to_string())
rooms = [room.room_id for room in rooms]
content = {}
events = []
for room_id in rooms:
result = yield self.store.get_linearized_receipts_for_room(
content = yield self.store.get_linearized_receipts_for_room(
room_id, from_key, to_key
)
if result:
content[room_id] = result
if content:
events.append({
"type": "m.receipt",
"room_id": room_id,
"content": content,
})
if not content:
defer.returnValue(([], to_key))
event = {
"type": "m.receipt",
"content": content,
}
defer.returnValue(([event], to_key))
defer.returnValue((events, to_key))