Skip to content

Commit 18f20a7

Browse files
committed
sdk: only share history if cross-signing is set up
... otherwise, it fails with an error, which makes the integ tests fail
1 parent 96bdd91 commit 18f20a7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,20 @@ use crate::{crypto::types::events::room_key_bundle::RoomKeyBundleContent, Error,
2525
/// [MSC4268]: https://github.com/matrix-org/matrix-spec-proposals/pull/4268
2626
#[instrument(skip(room), fields(room_id = ?room.room_id()))]
2727
pub async fn share_room_history(room: &Room, user_id: OwnedUserId) -> Result<()> {
28-
tracing::info!("Sharing message history");
2928
let client = &room.client;
3029

30+
// 0. We can only share room history if our user has set up cross signing
31+
let own_identity = match client.user_id() {
32+
Some(own_user) => client.encryption().get_user_identity(own_user).await?,
33+
None => None,
34+
};
35+
if own_identity.is_none() {
36+
tracing::warn!("Not sharing message history as cross-signing is not set up");
37+
return Ok(());
38+
}
39+
40+
tracing::info!("Sharing message history");
41+
3142
// 1. Construct the key bundle
3243
let bundle = {
3344
let olm_machine = client.olm_machine().await;

0 commit comments

Comments
 (0)