summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMathieu Velten <matmaul@gmail.com>2023-11-28 14:15:26 +0100
committerGitHub <noreply@github.com>2023-11-28 13:15:26 +0000
commitb0ed14d8156e611a5f8ee772e69e171bd645820c (patch)
tree45db2dcf282d45270f47355ccc8d4c45f9115004 /synapse/handlers
parentRemove old full schema dumps. (#16697) (diff)
downloadsynapse-b0ed14d8156e611a5f8ee772e69e171bd645820c.tar.xz
Ignore `encryption_enabled_by_default_for_room_type` for notices room (#16677)
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/room.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index afd8138caf..f865bed1ec 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -698,6 +698,7 @@ class RoomCreationHandler:
         config: JsonDict,
         ratelimit: bool = True,
         creator_join_profile: Optional[JsonDict] = None,
+        ignore_forced_encryption: bool = False,
     ) -> Tuple[str, Optional[RoomAlias], int]:
         """Creates a new room.
 
@@ -714,6 +715,8 @@ class RoomCreationHandler:
                 derived from the user's profile. If set, should contain the
                 values to go in the body of the 'join' event (typically
                 `avatar_url` and/or `displayname`.
+            ignore_forced_encryption:
+                Ignore encryption forced by `encryption_enabled_by_default_for_room_type` setting.
 
         Returns:
             A 3-tuple containing:
@@ -1015,6 +1018,7 @@ class RoomCreationHandler:
         room_alias: Optional[RoomAlias] = None,
         power_level_content_override: Optional[JsonDict] = None,
         creator_join_profile: Optional[JsonDict] = None,
+        ignore_forced_encryption: bool = False,
     ) -> Tuple[int, str, int]:
         """Sends the initial events into a new room. Sends the room creation, membership,
         and power level events into the room sequentially, then creates and batches up the
@@ -1049,6 +1053,8 @@ class RoomCreationHandler:
             creator_join_profile:
                 Set to override the displayname and avatar for the creating
                 user in this room.
+            ignore_forced_encryption:
+                Ignore encryption forced by `encryption_enabled_by_default_for_room_type` setting.
 
         Returns:
             A tuple containing the stream ID, event ID and depth of the last
@@ -1251,7 +1257,7 @@ class RoomCreationHandler:
             )
             events_to_send.append((event, context))
 
-        if config["encrypted"]:
+        if config["encrypted"] and not ignore_forced_encryption:
             encryption_event, encryption_context = await create_event(
                 EventTypes.RoomEncryption,
                 {"algorithm": RoomEncryptionAlgorithms.DEFAULT},