summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-04-26 16:18:08 +0100
committerErik Johnston <erik@matrix.org>2017-04-26 16:18:08 +0100
commit34e682d3855562a4ca6e32f366a2ecfa1c684a3a (patch)
tree6328201b5fb85cf4986cbb10066e6e7497d82bbc /synapse/events
parentMerge pull request #2160 from matrix-org/erikj/reduce_join_cache_size (diff)
downloadsynapse-34e682d3855562a4ca6e32f366a2ecfa1c684a3a.tar.xz
Fix invite state to always include all events
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/utils.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/synapse/events/utils.py b/synapse/events/utils.py
index 5bbaef8187..7ca7796558 100644
--- a/synapse/events/utils.py
+++ b/synapse/events/utils.py
@@ -225,7 +225,22 @@ def format_event_for_client_v2_without_room_id(d):
 
 def serialize_event(e, time_now_ms, as_client_event=True,
                     event_format=format_event_for_client_v1,
-                    token_id=None, only_event_fields=None):
+                    token_id=None, only_event_fields=None, is_invite=False):
+    """Serialize event for clients
+
+    Args:
+        e (EventBase)
+        time_now_ms (int)
+        as_client_event (bool)
+        event_format
+        token_id
+        only_event_fields
+        is_invite (bool): Whether this is an invite that is being sent to the
+            invitee
+
+    Returns:
+        dict
+    """
     # FIXME(erikj): To handle the case of presence events and the like
     if not isinstance(e, EventBase):
         return e
@@ -260,4 +275,7 @@ def serialize_event(e, time_now_ms, as_client_event=True,
             raise TypeError("only_event_fields must be a list of strings")
         d = only_fields(d, only_event_fields)
 
+    if not is_invite:
+        d["unsigned"].pop("invite_room_state", None)
+
     return d