Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ruma): Update Ruma to support negative bump_stamp #4026

Closed
wants to merge 1 commit into from
Closed
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
18 changes: 9 additions & 9 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ once_cell = "1.16.0"
pin-project-lite = "0.2.9"
rand = "0.8.5"
reqwest = { version = "0.12.4", default-features = false }
ruma = { git = "https://github.com/ruma/ruma", rev = "1ae98db9c44f46a590f4c76baf5cef70ebb6970d", features = [
ruma = { git = "https://github.com/Hywan/ruma", rev = "beb6d1b4145d7197203eddd72d4c2b3834b9b429", features = [
"client-api-c",
"compat-upload-signatures",
"compat-user-id",
Expand All @@ -61,7 +61,7 @@ ruma = { git = "https://github.com/ruma/ruma", rev = "1ae98db9c44f46a590f4c76baf
"unstable-msc4075",
"unstable-msc4140",
] }
ruma-common = { git = "https://github.com/ruma/ruma", rev = "1ae98db9c44f46a590f4c76baf5cef70ebb6970d" }
ruma-common = { git = "https://github.com/Hywan/ruma", rev = "beb6d1b4145d7197203eddd72d4c2b3834b9b429" }
serde = "1.0.151"
serde_html_form = "0.2.0"
serde_json = "1.0.91"
Expand Down
6 changes: 3 additions & 3 deletions crates/matrix-sdk-base/src/rooms/normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ impl Room {
///
/// Please read `RoomInfo::recency_stamp` to learn more.
#[cfg(feature = "experimental-sliding-sync")]
pub fn recency_stamp(&self) -> Option<u64> {
pub fn recency_stamp(&self) -> Option<i64> {
self.inner.read().recency_stamp
}

Expand Down Expand Up @@ -1094,7 +1094,7 @@ pub struct RoomInfo {
/// more accurate than relying on the latest event.
#[cfg(feature = "experimental-sliding-sync")]
#[serde(default)]
pub(crate) recency_stamp: Option<u64>,
pub(crate) recency_stamp: Option<i64>,
}

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
Expand Down Expand Up @@ -1547,7 +1547,7 @@ impl RoomInfo {
///
/// Please read [`Self::recency_stamp`] to learn more.
#[cfg(feature = "experimental-sliding-sync")]
pub(crate) fn update_recency_stamp(&mut self, stamp: u64) {
pub(crate) fn update_recency_stamp(&mut self, stamp: i64) {
self.recency_stamp = Some(stamp);
}

Expand Down
6 changes: 3 additions & 3 deletions crates/matrix-sdk-base/src/sliding_sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use ruma::{
GlobalAccountDataEventType,
},
serde::Raw,
JsOption, OwnedRoomId, RoomId, UInt,
Int, JsOption, OwnedRoomId, RoomId,
};
use tracing::{debug, error, instrument, trace, warn};

Expand Down Expand Up @@ -413,7 +413,7 @@ impl BaseClient {
if let Some(invite_state) = &room_data.invite_state {
room_data.to_mut().bump_stamp =
invite_state.iter().rev().find_map(|invite_state| {
invite_state.get_field::<UInt>("origin_server_ts").ok().flatten()
invite_state.get_field::<Int>("origin_server_ts").ok().flatten()
});

debug!(
Expand Down Expand Up @@ -851,7 +851,7 @@ fn process_room_properties(
}

if let Some(recency_stamp) = &room_data.bump_stamp {
let recency_stamp: u64 = (*recency_stamp).into();
let recency_stamp: i64 = (*recency_stamp).into();

if room_info.recency_stamp.as_ref() != Some(&recency_stamp) {
room_info.update_recency_stamp(recency_stamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ use super::{Room, Sorter};

struct RecencyMatcher<F>
where
F: Fn(&Room, &Room) -> (Option<u64>, Option<u64>),
F: Fn(&Room, &Room) -> (Option<i64>, Option<i64>),
{
recency_stamps: F,
}

impl<F> RecencyMatcher<F>
where
F: Fn(&Room, &Room) -> (Option<u64>, Option<u64>),
F: Fn(&Room, &Room) -> (Option<i64>, Option<i64>),
{
fn matches(&self, left: &Room, right: &Room) -> Ordering {
if left.id() == right.id() {
Expand Down
Loading