mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-05 22:28:54 +01:00
Check whether prev_content or prev_sender is set before trying to rollback state
This commit is contained in:
parent
a874c0894a
commit
834924248f
1 changed files with 13 additions and 8 deletions
|
@ -357,14 +357,19 @@ class SyncRestServlet(RestServlet):
|
||||||
if prev_event_id is None:
|
if prev_event_id is None:
|
||||||
del result[event_key]
|
del result[event_key]
|
||||||
else:
|
else:
|
||||||
result[event_key] = FrozenEvent({
|
prev_content = timeline_event.unsigned.get('prev_content')
|
||||||
"type": timeline_event.type,
|
prev_sender = timeline_event.unsigned.get('prev_sender')
|
||||||
"state_key": timeline_event.state_key,
|
if prev_content and prev_sender:
|
||||||
"content": timeline_event.unsigned['prev_content'],
|
result[event_key] = FrozenEvent({
|
||||||
"sender": timeline_event.unsigned['prev_sender'],
|
"type": timeline_event.type,
|
||||||
"event_id": prev_event_id,
|
"state_key": timeline_event.state_key,
|
||||||
"room_id": timeline_event.room_id,
|
"content": prev_content,
|
||||||
})
|
"sender": prev_sender,
|
||||||
|
"event_id": prev_event_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 a new issue