Skip to content

Commit c6d9930

Browse files
committed
fix(labs): Fix jack-in.
1 parent c86ebad commit c6d9930

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

crates/matrix-sdk/src/sliding_sync.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ use ruma::{
4343
},
4444
},
4545
assign,
46-
events::TimelineEventType,
46+
events::{AnySyncStateEvent, TimelineEventType},
47+
serde::Raw,
4748
OwnedRoomId, RoomId, UInt,
4849
};
4950
use serde::{Deserialize, Serialize};
@@ -166,7 +167,7 @@ impl From<&SlidingSyncRoom> for FrozenSlidingSyncRoom {
166167
fn from(value: &SlidingSyncRoom) -> Self {
167168
let locked_tl = value.timeline.lock_ref();
168169
let tl_len = locked_tl.len();
169-
// To not overflow the database, we only freeze the newest 10 items. on doing
170+
// To not overflow the database, we only freeze the newest 10 items. On doing
170171
// so, we must drop the `prev_batch` key however, as we'd otherwise
171172
// create a gap between what we have loaded and where the
172173
// prev_batch-key will start loading when paginating backwards.
@@ -298,6 +299,11 @@ impl SlidingSyncRoom {
298299
&self.inner.unread_notifications
299300
}
300301

302+
/// Get the required state.
303+
pub fn required_state(&self) -> &Vec<Raw<AnySyncStateEvent>> {
304+
&self.inner.required_state
305+
}
306+
301307
fn update(&mut self, room_data: &v4::SlidingSyncRoom, timeline: Vec<SyncTimelineEvent>) {
302308
let v4::SlidingSyncRoom {
303309
name,

labs/jack-in/src/components/details.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ impl Details {
5151
return;
5252
};
5353

54-
let name = room_data.name.clone().unwrap_or_else(|| "unknown".to_owned());
54+
let name = room_data.name().unwrap_or_else(|| "unknown").to_owned();
5555

5656
let state_events = room_data
57-
.required_state
57+
.required_state()
5858
.iter()
5959
.filter_map(|r| r.deserialize().ok())
6060
.fold(BTreeMap::<String, Vec<_>>::new(), |mut b, r| {

labs/jack-in/src/components/rooms.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ impl MockComponent for Rooms {
6464
let mut paras = vec![];
6565

6666
for r in self.sstate.get_all_rooms() {
67-
let mut cells =
68-
vec![Cell::from(r.name.clone().unwrap_or_else(|| "unknown".to_owned()))];
69-
if let Some(c) = r.unread_notifications.notification_count {
67+
let mut cells = vec![Cell::from(r.name().unwrap_or_else(|| "unknown").to_owned())];
68+
if let Some(c) = r.unread_notifications().notification_count {
7069
let count: u32 = c.try_into().unwrap_or_default();
7170
if count > 0 {
7271
cells.push(Cell::from(c.to_string()))

0 commit comments

Comments
 (0)