@@ -451,10 +451,11 @@ pub struct RoomInfo {
451451 pub ( crate ) encryption_state_synced : bool ,
452452
453453 /// The latest event value of this room.
454- ///
455- /// TODO(@hywan): Rename to `latest_event`.
454+ //
455+ // Note: Why `latest_event_value` and `latest_event`? Because `latest_event` existed before, we
456+ // don't want to collide.
456457 #[ serde( default ) ]
457- pub ( crate ) new_latest_event : LatestEventValue ,
458+ pub ( crate ) latest_event_value : LatestEventValue ,
458459
459460 /// Information about read receipts for this room.
460461 #[ serde( default ) ]
@@ -512,7 +513,7 @@ impl RoomInfo {
512513 last_prev_batch : None ,
513514 sync_info : SyncInfo :: NoState ,
514515 encryption_state_synced : false ,
515- new_latest_event : LatestEventValue :: default ( ) ,
516+ latest_event_value : LatestEventValue :: default ( ) ,
516517 read_receipts : Default :: default ( ) ,
517518 base_info : Box :: new ( BaseRoomInfo :: new ( ) ) ,
518519 warned_about_unknown_room_version_rules : Arc :: new ( false . into ( ) ) ,
@@ -1011,14 +1012,14 @@ impl RoomInfo {
10111012 . collect ( )
10121013 }
10131014
1014- /// Return the new [`LatestEventValue`].
1015- pub fn new_latest_event ( & self ) -> & LatestEventValue {
1016- & self . new_latest_event
1015+ /// Return the [`LatestEventValue`].
1016+ pub fn latest_event ( & self ) -> & LatestEventValue {
1017+ & self . latest_event_value
10171018 }
10181019
1019- /// Sets the new [`LatestEventValue`].
1020- pub fn set_new_latest_event ( & mut self , new_value : LatestEventValue ) {
1021- self . new_latest_event = new_value;
1020+ /// Set the [`LatestEventValue`].
1021+ pub fn set_latest_event ( & mut self , new_value : LatestEventValue ) {
1022+ self . latest_event_value = new_value;
10221023 }
10231024
10241025 /// Updates the recency stamp of this room.
@@ -1273,7 +1274,7 @@ mod tests {
12731274 last_prev_batch : Some ( "pb" . to_owned ( ) ) ,
12741275 sync_info : SyncInfo :: FullySynced ,
12751276 encryption_state_synced : true ,
1276- new_latest_event : LatestEventValue :: None ,
1277+ latest_event_value : LatestEventValue :: None ,
12771278 base_info : Box :: new (
12781279 assign ! ( BaseRoomInfo :: new( ) , { pinned_events: Some ( RoomPinnedEventsEventContent :: new( vec![ owned_event_id!( "$a" ) ] ) ) } ) ,
12791280 ) ,
@@ -1306,13 +1307,7 @@ mod tests {
13061307 "last_prev_batch" : "pb" ,
13071308 "sync_info" : "FullySynced" ,
13081309 "encryption_state_synced" : true ,
1309- "latest_event" : {
1310- "event" : {
1311- "kind" : { "PlainText" : { "event" : { "sender" : "@u:i.uk" } } } ,
1312- "thread_summary" : "None"
1313- } ,
1314- } ,
1315- "new_latest_event" : "None" ,
1310+ "latest_event_value" : "None" ,
13161311 "base_info" : {
13171312 "avatar" : null,
13181313 "canonical_alias" : null,
@@ -1507,7 +1502,7 @@ mod tests {
15071502 assert_eq ! ( info. last_prev_batch, Some ( "pb" . to_owned( ) ) ) ;
15081503 assert_eq ! ( info. sync_info, SyncInfo :: FullySynced ) ;
15091504 assert ! ( info. encryption_state_synced) ;
1510- assert_matches ! ( info. new_latest_event , LatestEventValue :: None ) ;
1505+ assert_matches ! ( info. latest_event_value , LatestEventValue :: None ) ;
15111506 assert ! ( info. base_info. avatar. is_none( ) ) ;
15121507 assert ! ( info. base_info. canonical_alias. is_none( ) ) ;
15131508 assert ! ( info. base_info. create. is_none( ) ) ;
0 commit comments