rustfmt
All checks were successful
CI / lint (push) Successful in 2m2s
CI / Build and test (, nightly) (push) Successful in 1m30s
CI / Build and test (, beta) (push) Successful in 4m2s
CI / Build and test (, 1.76.0) (push) Successful in 4m6s

This commit is contained in:
Val Lorentz 2024-02-11 14:19:18 +01:00
parent 5f38edcb3b
commit fab114459b

View File

@ -575,7 +575,12 @@ impl RoomBuffer {
let initial_roominfo_hash = hash_roominfo(room.clone_info()); let initial_roominfo_hash = hash_roominfo(room.clone_info());
let computed_roominfo = compute_room_info(room, initial_roominfo_hash).await; let computed_roominfo = compute_room_info(room, initial_roominfo_hash).await;
tokio::task::spawn(update_roominfo_worker(room_id.clone(), initial_roominfo_hash, roominfo_rx, computed_roominfo_tx)); tokio::task::spawn(update_roominfo_worker(
room_id.clone(),
initial_roominfo_hash,
roominfo_rx,
computed_roominfo_tx,
));
let mut self_ = RoomBuffer { let mut self_ = RoomBuffer {
config, config,
@ -652,7 +657,8 @@ impl Buffer for RoomBuffer {
fn short_name(&self) -> String { fn short_name(&self) -> String {
self self
.computed_roominfo .computed_roominfo
.display_name.as_ref() .display_name
.as_ref()
.map(|dn| dn.to_string()) .map(|dn| dn.to_string())
.unwrap_or_else(|| { .unwrap_or_else(|| {
self self
@ -675,13 +681,15 @@ impl Buffer for RoomBuffer {
fn parent(&self) -> Option<BufferId> { fn parent(&self) -> Option<BufferId> {
self self
.computed_roominfo .computed_roominfo
.parent.as_ref() .parent
.as_ref()
.map(|parent| BufferId::Room(parent.clone())) .map(|parent| BufferId::Room(parent.clone()))
} }
fn children(&self) -> Option<SortedVec<(BufferSortKey, BufferId)>> { fn children(&self) -> Option<SortedVec<(BufferSortKey, BufferId)>> {
self self
.computed_roominfo .computed_roominfo
.children.as_ref() .children
.as_ref()
.map(|children: &SortedVec<_>| { .map(|children: &SortedVec<_>| {
let children = children let children = children
.iter() .iter()
@ -773,10 +781,7 @@ impl Buffer for RoomBuffer {
} }
fn fully_read(&self) -> FullyReadStatus { fn fully_read(&self) -> FullyReadStatus {
match self match self.computed_roominfo.fully_read_at.as_ref() {
.computed_roominfo
.fully_read_at.as_ref()
{
None => FullyReadStatus::All, // Unknown, assume it's read for now, we'll probably find out later None => FullyReadStatus::All, // Unknown, assume it's read for now, we'll probably find out later
Some(fully_read_at) => { Some(fully_read_at) => {
// Iterate through all buffers, and if any buffer's last event is not the one where // Iterate through all buffers, and if any buffer's last event is not the one where
@ -1015,10 +1020,9 @@ async fn update_roominfo_worker(
} }
last_roominfo_hash = roominfo_hash; last_roominfo_hash = roominfo_hash;
tracing::trace!("visible change to {}", room_id); tracing::trace!("visible change to {}", room_id);
let room = buf let room = buf.client.get_room(&room_id).expect("client missing room");
.client computed_roominfo_tx
.get_room(&room_id) .send(compute_room_info(room, roominfo_hash).await)
.expect("client missing room"); .expect("failed to send to computed_roominfo_tx");
computed_roominfo_tx.send(compute_room_info(room, roominfo_hash).await).expect("failed to send to computed_roominfo_tx");
} }
} }