diff --git a/changelog.d/11666.feature b/changelog.d/11666.feature
new file mode 100644
index 0000000000..6f6b127e22
--- /dev/null
+++ b/changelog.d/11666.feature
@@ -0,0 +1 @@
+Include the room topic in the stripped state included with invites and knocking.
diff --git a/docs/sample_config.yaml b/docs/sample_config.yaml
index 6696ed5d1e..00dfd2c013 100644
--- a/docs/sample_config.yaml
+++ b/docs/sample_config.yaml
@@ -1488,6 +1488,7 @@ room_prejoin_state:
# - m.room.encryption
# - m.room.name
# - m.room.create
+ # - m.room.topic
#
# Uncomment the following to disable these defaults (so that only the event
# types listed in 'additional_event_types' are shared). Defaults to 'false'.
diff --git a/synapse/config/api.py b/synapse/config/api.py
index b18044f982..25538b82d5 100644
--- a/synapse/config/api.py
+++ b/synapse/config/api.py
@@ -107,6 +107,8 @@ _DEFAULT_PREJOIN_STATE_TYPES = [
EventTypes.Name,
# Per MSC1772.
EventTypes.Create,
+ # Per MSC3173.
+ EventTypes.Topic,
]
diff --git a/tests/federation/transport/test_knocking.py b/tests/federation/transport/test_knocking.py
index 663960ff53..bfa156eebb 100644
--- a/tests/federation/transport/test_knocking.py
+++ b/tests/federation/transport/test_knocking.py
@@ -108,6 +108,15 @@ class KnockingStrippedStateEventHelperMixin(TestCase):
"state_key": "",
},
),
+ (
+ EventTypes.Topic,
+ {
+ "content": {
+ "topic": "A really cool room",
+ },
+ "state_key": "",
+ },
+ ),
]
)
|