WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ as_variant = "1.3.0"
assert-json-diff = "2.0.2"
assert_matches = "1.5.0"
assert_matches2 = "0.1.2"
async_cell = "0.2.3"
async-compat = "0.2.5"
async-once-cell = "0.5.4"
async-rx = "0.1.3"
# Bumping this to 0.3.6 produces a test failure because the semantic between the
# versions changed subtly: https://github.com/matrix-org/matrix-rust-sdk/issues/4599
Expand Down
7 changes: 7 additions & 0 deletions crates/matrix-sdk-base/src/latest_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ impl LatestEventValue {
Self::None | Self::Remote(_) => false,
}
}

/// Check whether the [`LatestEventValue`] is not set, i.e. [`None`].
///
/// [`None`]: LatestEventValue::None
pub fn is_none(&self) -> bool {
matches!(self, Self::None)
}
}

/// Represents the value for [`LatestEventValue::Remote`].
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ experimental-encrypted-state-events = [
as_variant.workspace = true
async-rx.workspace = true
async-stream.workspace = true
async_cell = "0.2.3"
async_cell.workspace = true
bitflags.workspace = true
chrono.workspace = true
eyeball.workspace = true
Expand Down
41 changes: 23 additions & 18 deletions crates/matrix-sdk-ui/tests/integration/room_list_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ async fn test_room_sorting() -> Result<(), Error> {
// Now, let's define a filter.
dynamic_entries.set_filter(Box::new(new_filter_non_left()));

// Assert rooms are sorted by recency and by name!.
// Assert rooms are sorted by recency and by name!
assert_entries_batch! {
[stream]
reset [
Expand Down Expand Up @@ -1925,7 +1925,7 @@ async fn test_room_sorting() -> Result<(), Error> {
"timeline": [{
"content": {
"body": "foo",
"msgtype": "m.text"
"msgtype": "m.text",
},
"event_id": "$ev7",
"origin_server_ts": 7,
Expand Down Expand Up @@ -2015,7 +2015,7 @@ async fn test_room_sorting() -> Result<(), Error> {
// | 3 | !r4 | 5 | |
// | 4 | !r3 | 4 | |

// The Latest Events are updated.
// Rooms are individually updated.
assert_entries_batch! {
[stream]
set [ 1 ] [ "!r0:bar.org" ];
Expand Down Expand Up @@ -2086,19 +2086,7 @@ async fn test_room_sorting() -> Result<(), Error> {

assert_entries_batch! {
[stream]
insert [ 3 ] [ "!r6:bar.org" ];
end;
};

// The Latest Event is updated.
assert_entries_batch! {
[stream]
set [ 3 ] [ "!r6:bar.org" ];
end;
};
assert_entries_batch! {
[stream]
set [ 3 ] [ "!r6:bar.org" ];
insert [ 1 ] [ "!r6:bar.org" ];
end;
};

Expand All @@ -2113,6 +2101,18 @@ async fn test_room_sorting() -> Result<(), Error> {
// | 4 | !r4 | 5 | |
// | 5 | !r3 | 4 | |

// Rooms are individually updated.
assert_entries_batch! {
[stream]
set [ 1 ] [ "!r6:bar.org" ];
end;
};
assert_entries_batch! {
[stream]
set [ 1 ] [ "!r6:bar.org" ];
end;
};

assert_entries_batch! {
[stream]
remove [ 5 ];
Expand All @@ -2131,17 +2131,22 @@ async fn test_room_sorting() -> Result<(), Error> {
// | 4 | !r1 | 6 | Aaa |
// | 5 | !r4 | 5 | |

// The Latest Events are updated.
// Rooms are individually updated.
assert_entries_batch! {
[stream]
set [ 4 ] [ "!r6:bar.org" ];
set [ 2 ] [ "!r6:bar.org" ];
end;
};
assert_entries_batch! {
[stream]
set [ 0 ] [ "!r3:bar.org" ];
end;
};
assert_entries_batch! {
[stream]
set [ 2 ] [ "!r6:bar.org" ];
end;
};

assert_pending!(stream);

Expand Down
3 changes: 3 additions & 0 deletions crates/matrix-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ All notable changes to this project will be documented in this file.

### Bugfix

- Latest Event is lazier: a `RoomLatestEvents` can be registered even if its
associated `RoomEventCache` isn't created yet.
([#5947](https://github.com/matrix-org/matrix-rust-sdk/pull/5947))
- Allow granting of QR login to a new client whose device ID is not a base64
encoded Curve25519 public key.
([#5940](https://github.com/matrix-org/matrix-rust-sdk/pull/5940))
Expand Down
1 change: 1 addition & 0 deletions crates/matrix-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ assert_matches2 = { workspace = true, optional = true }
async-channel = "2.5.0"
async-stream.workspace = true
async-trait.workspace = true
async-once-cell.workspace = true
axum = { version = "0.8.4", optional = true }
bytes = "1.11.0"
bytesize = "2.3.0"
Expand Down
Loading
Loading