mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-25 03:35:28 +00:00
Combine the prev content tests
This commit is contained in:
parent
834924248f
commit
070e28e203
@ -354,12 +354,11 @@ class SyncRestServlet(RestServlet):
|
|||||||
logger.debug("Replacing %s with %s in state dict",
|
logger.debug("Replacing %s with %s in state dict",
|
||||||
timeline_event.event_id, prev_event_id)
|
timeline_event.event_id, prev_event_id)
|
||||||
|
|
||||||
if prev_event_id is None:
|
|
||||||
del result[event_key]
|
|
||||||
else:
|
|
||||||
prev_content = timeline_event.unsigned.get('prev_content')
|
prev_content = timeline_event.unsigned.get('prev_content')
|
||||||
prev_sender = timeline_event.unsigned.get('prev_sender')
|
prev_sender = timeline_event.unsigned.get('prev_sender')
|
||||||
if prev_content and prev_sender:
|
if prev_event_id is None or not prev_content or not prev_sender:
|
||||||
|
del result[event_key]
|
||||||
|
else:
|
||||||
result[event_key] = FrozenEvent({
|
result[event_key] = FrozenEvent({
|
||||||
"type": timeline_event.type,
|
"type": timeline_event.type,
|
||||||
"state_key": timeline_event.state_key,
|
"state_key": timeline_event.state_key,
|
||||||
@ -368,8 +367,7 @@ class SyncRestServlet(RestServlet):
|
|||||||
"event_id": prev_event_id,
|
"event_id": prev_event_id,
|
||||||
"room_id": timeline_event.room_id,
|
"room_id": timeline_event.room_id,
|
||||||
})
|
})
|
||||||
else:
|
|
||||||
del result[event_key]
|
|
||||||
logger.debug("New value: %r", result.get(event_key))
|
logger.debug("New value: %r", result.get(event_key))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user