Skip to content

Commit 24502d2

Browse files
committed
fix(sdk): Check correct encryption state for encrypted state events
1 parent 7880ec5 commit 24502d2

File tree

1 file changed

+16
-1
lines changed
  • crates/matrix-sdk/src/room

1 file changed

+16
-1
lines changed

crates/matrix-sdk/src/room/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1929,13 +1929,28 @@ impl Room {
19291929
)
19301930
.await;
19311931

1932-
// If encryption was enabled, return.
19331932
let _sync_lock = self.client.base_client().sync_lock().lock().await;
1933+
1934+
// If encryption was enabled, return.
1935+
#[cfg(not(feature = "experimental-encrypted-state-events"))]
19341936
if res.is_ok() && self.inner.encryption_state().is_encrypted() {
19351937
debug!("room successfully marked as encrypted");
19361938
return Ok(());
19371939
}
19381940

1941+
// If encryption with state event encryption was enabled, return.
1942+
#[cfg(feature = "experimental-encrypted-state-events")]
1943+
if res.is_ok() && {
1944+
if encrypted_state_events {
1945+
self.inner.encryption_state().is_state_encrypted()
1946+
} else {
1947+
self.inner.encryption_state().is_encrypted()
1948+
}
1949+
} {
1950+
debug!("room successfully marked as encrypted");
1951+
return Ok(());
1952+
}
1953+
19391954
// If after waiting for multiple syncs, we don't have the encryption state we
19401955
// expect, assume the local encryption state is incorrect; this will
19411956
// cause the SDK to re-request it later for confirmation, instead of

0 commit comments

Comments
 (0)