File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
crates/matrix-sdk/src/latest_events Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ use ruma::{
31
31
} ;
32
32
use tracing:: warn;
33
33
34
- use crate :: { event_cache:: RoomEventCache , room:: WeakRoom } ;
34
+ use crate :: { event_cache:: RoomEventCache , room:: WeakRoom , send_queue :: RoomSendQueueUpdate } ;
35
35
36
36
/// The latest event of a room or a thread.
37
37
///
@@ -84,6 +84,12 @@ impl LatestEvent {
84
84
85
85
self . value . set ( new_value) . await ;
86
86
}
87
+
88
+ /// Update the inner latest event value, based on the send queue
89
+ /// (specifically with a [`RoomSendQueueUpdate`]).
90
+ pub async fn update_with_send_queue ( & mut self , send_queue_update : & RoomSendQueueUpdate ) {
91
+ todo ! ( )
92
+ }
87
93
}
88
94
89
95
/// A latest event value!
Original file line number Diff line number Diff line change @@ -532,6 +532,16 @@ impl RoomLatestEvents {
532
532
latest_event. update_with_event_cache ( & self . room_event_cache , & power_levels) . await ;
533
533
}
534
534
}
535
+
536
+ /// Update the latest events for the room and its threads, based on the
537
+ /// send queue update.
538
+ async fn update_with_send_queue ( & mut self , send_queue_update : & RoomSendQueueUpdate ) {
539
+ self . for_the_room . update_with_send_queue ( send_queue_update) . await ;
540
+
541
+ for latest_event in self . per_thread . values_mut ( ) {
542
+ latest_event. update_with_send_queue ( send_queue_update) . await ;
543
+ }
544
+ }
535
545
}
536
546
537
547
/// The task responsible to listen to the [`EventCache`] and the [`SendQueue`].
@@ -687,9 +697,15 @@ async fn compute_latest_events(
687
697
}
688
698
689
699
LatestEventQueueUpdate :: SendQueue { room_id, update } => {
690
- // let mut rooms = registered_rooms.rooms.write().await;
700
+ let mut rooms = registered_rooms. rooms . write ( ) . await ;
691
701
692
- todo ! ( )
702
+ if let Some ( room_latest_events) = rooms. get_mut ( room_id) {
703
+ room_latest_events. update_with_send_queue ( update) . await ;
704
+ } else {
705
+ error ! ( ?room_id, "Failed to find the room" ) ;
706
+
707
+ continue ;
708
+ }
693
709
}
694
710
}
695
711
}
You can’t perform that action at this time.
0 commit comments