mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 10:53:52 +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:
|
||||||
|
prev_content = timeline_event.unsigned.get('prev_content')
|
||||||
|
prev_sender = timeline_event.unsigned.get('prev_sender')
|
||||||
|
if prev_content and prev_sender:
|
||||||
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,
|
||||||
"content": timeline_event.unsigned['prev_content'],
|
"content": prev_content,
|
||||||
"sender": timeline_event.unsigned['prev_sender'],
|
"sender": prev_sender,
|
||||||
"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 a new issue