summary refs log tree commit diff
diff options
context:
space:
mode:
authorH. Shay <hillerys@element.io>2023-03-16 14:55:49 -0700
committerH. Shay <hillerys@element.io>2023-03-16 14:55:49 -0700
commit4809a0cb357819b8d704aa00c748c1b99547b046 (patch)
treecc3728f19c844598336fe6940e58eeaed1ba15a0
parentMerge branch 'develop' into shay/rework_module (diff)
downloadsynapse-github/shay/rework_module.tar.xz
-rw-r--r--synapse/handlers/room.py40
1 files changed, 22 insertions, 18 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index f28a602741..e5bffa9e25 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -1291,39 +1291,43 @@ class RoomCreationHandler:
             if encrypt_tp_event:
                 third_party_events_to_append.append(encrypt_tp_event)
 
-        for event_dict in third_party_events_to_append:
-            (
-                event,
-                unpersisted_context,
-                _,
-            ) = await self.event_creation_handler.create_event(
-                creator,
-                event_dict,
-                prev_event_ids=prev_event,
-                state_map=state_map,
-                for_batch=True,
-                current_state_group=current_state_group,
-            )
-            context = await unpersisted_context.persist(event)
-            events_to_send.append((event, context))
-
         if "name" in room_config:
             name = room_config["name"]
-            name_event, name_context = await create_event(
+            name_event, name_context, name_tp_event = await create_event(
                 EventTypes.Name,
                 {"name": name},
                 True,
             )
             events_to_send.append((name_event, name_context))
+            if name_tp_event:
+                third_party_events_to_append.append(name_tp_event)
 
         if "topic" in room_config:
             topic = room_config["topic"]
-            topic_event, topic_context = await create_event(
+            topic_event, topic_context, topic_tp_event = await create_event(
                 EventTypes.Topic,
                 {"topic": topic},
                 True,
             )
             events_to_send.append((topic_event, topic_context))
+            if topic_tp_event:
+                third_party_events_to_append.append(topic_tp_event)
+
+        for event_dict in third_party_events_to_append:
+            (
+                event,
+                unpersisted_context,
+                _,
+            ) = await self.event_creation_handler.create_event(
+                creator,
+                event_dict,
+                prev_event_ids=prev_event,
+                state_map=state_map,
+                for_batch=True,
+                current_state_group=current_state_group,
+            )
+            context = await unpersisted_context.persist(event)
+            events_to_send.append((event, context))
 
         datastore = self.hs.get_datastores().state
         events_and_context = (