diff --git a/src/config.rs b/src/config.rs index dd6857463..accf04724 100644 --- a/src/config.rs +++ b/src/config.rs @@ -507,7 +507,11 @@ impl Config { pub(crate) fn is_synced(&self) -> bool { matches!( self, - Self::Displayname | Self::MdnsEnabled | Self::Selfavatar | Self::Selfstatus, + Self::Displayname + | Self::MdnsEnabled + | Self::Selfavatar + | Self::Selfstatus + | Self::ForceEncryption, ) } diff --git a/src/sync.rs b/src/sync.rs index 8b050456d..3f386bdea 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -810,4 +810,23 @@ mod tests { assert_eq!(msg.text, "Member Me added by alice@example.org."); Ok(()) } + + /// Tests that "force encryption" setting is synced. + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + async fn test_sync_force_encryption() -> Result<()> { + let mut tcm = TestContextManager::new(); + let alice = &tcm.alice().await; + let alice2 = &tcm.alice().await; + alice.set_config_bool(Config::SyncMsgs, true).await?; + alice2.set_config_bool(Config::SyncMsgs, true).await?; + + assert_eq!(alice.get_config_bool(Config::ForceEncryption).await?, true); + alice2 + .set_config_bool(Config::ForceEncryption, false) + .await?; + test_utils::sync(alice2, alice).await; + assert_eq!(alice.get_config_bool(Config::ForceEncryption).await?, false); + + Ok(()) + } }