mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-08-07 05:22:31 -04:00
feat(ui): latest_event sorter handles LatestEventValue::LocalHasBeenSent.
This patch changes the semantics of the Room List `latest_event` sorter by changing “is local” to “is remote like”, to include the new `LatestEventValue::LocalHasBeenSent` variant.
This commit is contained in:
1 parent
631671fb1c
commit
ccf11ad041
4 files changed
+100
-86
No files matched your search
@@ -65,6 +65,18 @@ impl LatestEventValue {
|
||||
}
|
||||
}
|
||||
|
||||
/// Check whether the [`LatestEventValue`] represents an unsent event, i.e.
|
||||
/// is [`LocalIsSending`] nor [`LocalCannotBeSent`].
|
||||
///
|
||||
/// [`LocalIsSending`]: LatestEventValue::LocalIsSending
|
||||
/// [`LocalCannotBeSent`]: LatestEventValue::LocalCannotBeSent
|
||||
pub fn is_unsent(&self) -> bool {
|
||||
match self {
|
||||
Self::LocalIsSending(_) | Self::LocalCannotBeSent(_) => true,
|
||||
Self::LocalHasBeenSent(_) | Self::Remote(_) | Self::None => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Check whether the [`LatestEventValue`] is not set, i.e. [`None`].
|
||||
///
|
||||
/// [`None`]: LatestEventValue::None
|
||||
|
||||
@@ -31,8 +31,8 @@ impl Room {
|
||||
self.info.read().latest_event_value.timestamp()
|
||||
}
|
||||
|
||||
/// Return the value of [`LatestEventValue::is_local`].
|
||||
pub fn latest_event_is_local(&self) -> bool {
|
||||
self.info.read().latest_event_value.is_local()
|
||||
/// Return the value of [`LatestEventValue::is_unsent`].
|
||||
pub fn latest_event_is_unsent(&self) -> bool {
|
||||
self.info.read().latest_event_value.is_unsent()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user