diff --git a/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs b/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs index c46747a2c31..ee7bf4ad32b 100644 --- a/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs +++ b/crates/matrix-sdk-crypto/src/olm/group_sessions/inbound.rs @@ -764,7 +764,7 @@ mod tests { "signing_key":{"ed25519":"wTRTdz4rn4EY+68cKPzpMdQ6RAlg7T8cbTmEjaXuUww"}, "sender_data":{ "UnknownDevice":{ - "legacy_session":true + "legacy_session":false } }, "room_id":"!test:localhost", diff --git a/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data.rs b/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data.rs index ad4336958ad..5b61d1e8409 100644 --- a/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data.rs +++ b/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data.rs @@ -76,24 +76,16 @@ pub enum SenderData { } impl SenderData { - /// Create a [`SenderData`] which contains no device info and will be - /// retried soon. + /// Create a [`SenderData`] which contains no device info. pub fn unknown() -> Self { - Self::UnknownDevice { - // TODO: when we have implemented all of SenderDataFinder, - // legacy_session should be set to false, but for now we leave - // it as true because we might lose device info while - // this code is still in transition. - legacy_session: true, - owner_check_failed: false, - } + Self::UnknownDevice { legacy_session: false, owner_check_failed: false } } /// Create a [`SenderData`] which has the legacy flag set. Caution: messages /// within sessions with this flag will be displayed in some contexts, /// even when we are unable to verify the sender. /// - /// The returned struct contains no device info, and will be retried soon. + /// The returned struct contains no device info. pub fn legacy() -> Self { Self::UnknownDevice { legacy_session: true, owner_check_failed: false } } @@ -102,9 +94,8 @@ impl SenderData { /// Used when deserialising and the sender_data property is missing. /// If we are deserialising an InboundGroupSession session with missing /// sender_data, this must be a legacy session (i.e. it was created before we -/// started tracking sender data). We set its legacy flag to true, and set it up -/// to be retried soon, so we can populate it with trust information if it is -/// available. +/// started tracking sender data). We set its legacy flag to true, so we can +/// populate it with trust information if it is available later. impl Default for SenderData { fn default() -> Self { Self::legacy() diff --git a/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs b/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs index fb81e9b9afa..c5bd07c8089 100644 --- a/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs +++ b/crates/matrix-sdk-crypto/src/olm/group_sessions/sender_data_finder.rs @@ -203,10 +203,7 @@ impl<'a> SenderDataFinder<'a> { let sender_data = SenderData::UnknownDevice { // This is not a legacy session since we did attempt to look // up its sender data at the time of reception. - // legacy_session: false, - // TODO: we set legacy to true for now, since our implementation is incomplete, so - // we may not have had a proper chance to look up the sender data. - legacy_session: true, + legacy_session: false, owner_check_failed: false, }; Ok(sender_data) @@ -247,10 +244,7 @@ impl<'a> SenderDataFinder<'a> { (false, _) => { // Step E (the device does not own the session) // Give up: something is wrong with the session. - SenderData::UnknownDevice { - legacy_session: true, // TODO: change to false when all SenderData work is done - owner_check_failed: true, - } + SenderData::UnknownDevice { legacy_session: false, owner_check_failed: true } } }) } @@ -420,10 +414,7 @@ mod tests { // Then we get back no useful information at all assert_let!(SenderData::UnknownDevice { legacy_session, owner_check_failed } = sender_data); - // TODO: This should not be marked as a legacy session, but for now it is - // because we haven't finished implementing the whole sender_data and - // retry mechanism. - assert!(legacy_session); + assert!(!legacy_session); assert!(!owner_check_failed); } @@ -680,10 +671,7 @@ mod tests { // Then we fail to find useful sender data assert_let!(SenderData::UnknownDevice { legacy_session, owner_check_failed } = sender_data); - // TODO: This should not be marked as a legacy session, but for now it is - // because we haven't finished implementing the whole sender_data and - // retry mechanism. - assert!(legacy_session); + assert!(!legacy_session); // And report that the owner_check_failed assert!(owner_check_failed);