From 3e9ee62db0bfb3991254f7152b70491cbda385b1 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 21 Aug 2015 09:15:13 +0100 Subject: [PATCH 1/2] Add missing param in store.get_state_groups invocation --- synapse/handlers/federation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 1e3dccf5a..4ff20599d 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -874,7 +874,7 @@ class FederationHandler(BaseHandler): raise AuthError(403, "Host not in room.") state_groups = yield self.store.get_state_groups( - [event_id] + room_id, [event_id] ) if state_groups: From 1f7642efa9f7165706593d745aab467b7fdddd67 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 21 Aug 2015 09:36:07 +0100 Subject: [PATCH 2/2] Fix bug where we didn't correctly serialize the redacted_because key over federation --- synapse/events/__init__.py | 5 ++++- synapse/storage/events.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py index 39ce4f7c4..3fb4b5e79 100644 --- a/synapse/events/__init__.py +++ b/synapse/events/__init__.py @@ -90,7 +90,7 @@ class EventBase(object): d = dict(self._event_dict) d.update({ "signatures": self.signatures, - "unsigned": self.unsigned, + "unsigned": dict(self.unsigned), }) return d @@ -109,6 +109,9 @@ class EventBase(object): pdu_json.setdefault("unsigned", {})["age"] = int(age) del pdu_json["unsigned"]["age_ts"] + # This may be a frozen event + pdu_json["unsigned"].pop("redacted_because", None) + return pdu_json def __set__(self, instance, value): diff --git a/synapse/storage/events.py b/synapse/storage/events.py index 5b6491802..e3eabab13 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -811,6 +811,8 @@ class EventsStore(SQLBaseStore): ) 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 if get_prev_content and "replaces_state" in ev.unsigned: