forked from MirrorHub/synapse
Fix bug where we didn't correctly serialize the redacted_because key over federation
This commit is contained in:
parent
3e9ee62db0
commit
1f7642efa9
2 changed files with 6 additions and 1 deletions
|
@ -90,7 +90,7 @@ class EventBase(object):
|
||||||
d = dict(self._event_dict)
|
d = dict(self._event_dict)
|
||||||
d.update({
|
d.update({
|
||||||
"signatures": self.signatures,
|
"signatures": self.signatures,
|
||||||
"unsigned": self.unsigned,
|
"unsigned": dict(self.unsigned),
|
||||||
})
|
})
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
@ -109,6 +109,9 @@ class EventBase(object):
|
||||||
pdu_json.setdefault("unsigned", {})["age"] = int(age)
|
pdu_json.setdefault("unsigned", {})["age"] = int(age)
|
||||||
del pdu_json["unsigned"]["age_ts"]
|
del pdu_json["unsigned"]["age_ts"]
|
||||||
|
|
||||||
|
# This may be a frozen event
|
||||||
|
pdu_json["unsigned"].pop("redacted_because", None)
|
||||||
|
|
||||||
return pdu_json
|
return pdu_json
|
||||||
|
|
||||||
def __set__(self, instance, value):
|
def __set__(self, instance, value):
|
||||||
|
|
|
@ -811,6 +811,8 @@ class EventsStore(SQLBaseStore):
|
||||||
)
|
)
|
||||||
|
|
||||||
if because:
|
if because:
|
||||||
|
# It's fine to do add the event directly, since get_pdu_json
|
||||||
|
# will serialise this field correctly
|
||||||
ev.unsigned["redacted_because"] = because
|
ev.unsigned["redacted_because"] = because
|
||||||
|
|
||||||
if get_prev_content and "replaces_state" in ev.unsigned:
|
if get_prev_content and "replaces_state" in ev.unsigned:
|
||||||
|
|
Loading…
Reference in a new issue