Fix encryption_enabled_by_default_for_room_type
When set to "invite" all rooms were created with encryption
This commit is contained in:
@@ -310,12 +310,15 @@ pub(crate) async fn create_room_route(
|
|||||||
let config = services
|
let config = services
|
||||||
.config
|
.config
|
||||||
.encryption_enabled_by_default_for_room_type
|
.encryption_enabled_by_default_for_room_type
|
||||||
.as_deref()
|
.as_deref();
|
||||||
.unwrap_or("off");
|
|
||||||
|
|
||||||
let invite = matches!(config, "invite");
|
let should_encrypt = match config {
|
||||||
let always = matches!(config, "all" | "invite");
|
| Some("all") => true,
|
||||||
if always || (invite && matches!(preset, PrivateChat | TrustedPrivateChat)) {
|
| Some("invite") => matches!(preset, PrivateChat | TrustedPrivateChat),
|
||||||
|
| _ => false,
|
||||||
|
};
|
||||||
|
|
||||||
|
if should_encrypt {
|
||||||
let algorithm = EventEncryptionAlgorithm::MegolmV1AesSha2;
|
let algorithm = EventEncryptionAlgorithm::MegolmV1AesSha2;
|
||||||
let content = RoomEncryptionEventContent::new(algorithm);
|
let content = RoomEncryptionEventContent::new(algorithm);
|
||||||
services
|
services
|
||||||
|
|||||||
Reference in New Issue
Block a user