summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Cloke <patrickc@matrix.org>2023-07-18 08:49:08 -0400
committerPatrick Cloke <patrickc@matrix.org>2023-07-18 09:50:05 -0400
commit3fc09bb13a564ad175a1ac906b49678e4424c358 (patch)
treebc2adf0d1c3816913ae2b5aaae85a1cafdc865b3
parentProvide templated LPDUs for make_{join,leave,knock} requests. (diff)
downloadsynapse-3fc09bb13a564ad175a1ac906b49678e4424c358.tar.xz
Remove unsigned and depth in more places.
-rw-r--r--synapse/events/__init__.py8
-rw-r--r--synapse/events/builder.py3
2 files changed, 10 insertions, 1 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index f2f8e1a935..87529854c4 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -620,6 +620,14 @@ class FrozenLinearizedEvent(FrozenEventV3):
             return self.hub_server
         return super().pdu_domain
 
+    def get_pdu_json(self, time_now: Optional[int] = None) -> JsonDict:
+        pdu = super().get_pdu_json()
+
+        # Internally Synapse uses unsigned, but this isn't part of LM.
+        pdu.pop("unsigned")
+
+        return pdu
+
     def get_linearized_pdu_json(self) -> JsonDict:
         # Get the full PDU and then remove fields from it.
         pdu = self.get_pdu_json()
diff --git a/synapse/events/builder.py b/synapse/events/builder.py
index 65979e89dc..94e5688759 100644
--- a/synapse/events/builder.py
+++ b/synapse/events/builder.py
@@ -170,8 +170,9 @@ class EventBuilder:
             "sender": self.sender,
             "content": self.content,
             "unsigned": self.unsigned,
-            "depth": depth,
         }
+        if not self.room_version.linearized_matrix:
+            event_dict["depth"] = depth
 
         if self.is_state():
             event_dict["state_key"] = self._state_key