Skip to content

Commit

Permalink
!fixup recency timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jul 3, 2024
1 parent 6bf4dd0 commit d108426
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
36 changes: 12 additions & 24 deletions crates/matrix-sdk-base/src/sliding_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1748,12 +1748,9 @@ mod tests {
let room_id = room_id!("!r:e.uk");

// When I send sliding sync response containing a room with a recency timestamp
let room = {
let mut room = v4::SlidingSyncRoom::new();
room.timestamp = Some(MilliSecondsSinceUnixEpoch(42u32.into()));

room
};
let room = assign!(v4::SlidingSyncRoom::new(), {
timestamp: Some(MilliSecondsSinceUnixEpoch(42u32.into())),
});
let response = response_with_room(room_id, room);
client.process_sliding_sync(&response, &()).await.expect("Failed to process sync");

Expand All @@ -1770,12 +1767,9 @@ mod tests {

{
// When I send sliding sync response containing a room with a recency timestamp
let room = {
let mut room = v4::SlidingSyncRoom::new();
room.timestamp = Some(MilliSecondsSinceUnixEpoch(42u32.into()));

room
};
let room = assign!(v4::SlidingSyncRoom::new(), {
timestamp: Some(MilliSecondsSinceUnixEpoch(42u32.into())),
});
let response = response_with_room(room_id, room);
client.process_sliding_sync(&response, &()).await.expect("Failed to process sync");

Expand All @@ -1789,12 +1783,9 @@ mod tests {

{
// When I send sliding sync response containing a room with NO recency timestamp
let room = {
let mut room = v4::SlidingSyncRoom::new();
room.timestamp = None;

room
};
let room = assign!(v4::SlidingSyncRoom::new(), {
timestamp: None,
});
let response = response_with_room(room_id, room);
client.process_sliding_sync(&response, &()).await.expect("Failed to process sync");

Expand All @@ -1809,12 +1800,9 @@ mod tests {
{
// When I send sliding sync response containing a room with a NEW recency
// timestamp
let room = {
let mut room = v4::SlidingSyncRoom::new();
room.timestamp = Some(MilliSecondsSinceUnixEpoch(153u32.into()));

room
};
let room = assign!(v4::SlidingSyncRoom::new(), {
timestamp: Some(MilliSecondsSinceUnixEpoch(153u32.into())),
});
let response = response_with_room(room_id, room);
client.process_sliding_sync(&response, &()).await.expect("Failed to process sync");

Expand Down
8 changes: 1 addition & 7 deletions crates/matrix-sdk-base/src/store/migration_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ use std::{

#[cfg(feature = "experimental-sliding-sync")]
use matrix_sdk_common::deserialized_responses::SyncTimelineEvent;
#[cfg(feature = "experimental-sliding-sync")]
use ruma::MilliSecondsSinceUnixEpoch;
use ruma::{
events::{
room::{
Expand Down Expand Up @@ -82,8 +80,6 @@ pub struct RoomInfoV1 {
#[cfg(feature = "experimental-sliding-sync")]
latest_event: Option<SyncTimelineEvent>,
base_info: BaseRoomInfoV1,
#[cfg(feature = "experimental-sliding-sync")]
recency_timestamp: Option<MilliSecondsSinceUnixEpoch>,
}

impl RoomInfoV1 {
Expand Down Expand Up @@ -112,8 +108,6 @@ impl RoomInfoV1 {
#[cfg(feature = "experimental-sliding-sync")]
latest_event,
base_info,
#[cfg(feature = "experimental-sliding-sync")]
recency_timestamp,
} = self;

RoomInfo {
Expand All @@ -132,7 +126,7 @@ impl RoomInfoV1 {
warned_about_unknown_room_version: Arc::new(false.into()),
cached_display_name: None,
#[cfg(feature = "experimental-sliding-sync")]
recency_timestamp,
recency_timestamp: None,
}
}
}
Expand Down

0 comments on commit d108426

Please sign in to comment.