@@ -451,10 +451,11 @@ pub struct RoomInfo {
451
451
pub ( crate ) encryption_state_synced : bool ,
452
452
453
453
/// 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.
456
457
#[ serde( default ) ]
457
- pub ( crate ) new_latest_event : LatestEventValue ,
458
+ pub ( crate ) latest_event_value : LatestEventValue ,
458
459
459
460
/// Information about read receipts for this room.
460
461
#[ serde( default ) ]
@@ -512,7 +513,7 @@ impl RoomInfo {
512
513
last_prev_batch : None ,
513
514
sync_info : SyncInfo :: NoState ,
514
515
encryption_state_synced : false ,
515
- new_latest_event : LatestEventValue :: default ( ) ,
516
+ latest_event_value : LatestEventValue :: default ( ) ,
516
517
read_receipts : Default :: default ( ) ,
517
518
base_info : Box :: new ( BaseRoomInfo :: new ( ) ) ,
518
519
warned_about_unknown_room_version_rules : Arc :: new ( false . into ( ) ) ,
@@ -1011,14 +1012,14 @@ impl RoomInfo {
1011
1012
. collect ( )
1012
1013
}
1013
1014
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
1017
1018
}
1018
1019
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;
1022
1023
}
1023
1024
1024
1025
/// Updates the recency stamp of this room.
@@ -1273,7 +1274,7 @@ mod tests {
1273
1274
last_prev_batch : Some ( "pb" . to_owned ( ) ) ,
1274
1275
sync_info : SyncInfo :: FullySynced ,
1275
1276
encryption_state_synced : true ,
1276
- new_latest_event : LatestEventValue :: None ,
1277
+ latest_event_value : LatestEventValue :: None ,
1277
1278
base_info : Box :: new (
1278
1279
assign ! ( BaseRoomInfo :: new( ) , { pinned_events: Some ( RoomPinnedEventsEventContent :: new( vec![ owned_event_id!( "$a" ) ] ) ) } ) ,
1279
1280
) ,
@@ -1306,13 +1307,7 @@ mod tests {
1306
1307
"last_prev_batch" : "pb" ,
1307
1308
"sync_info" : "FullySynced" ,
1308
1309
"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" ,
1316
1311
"base_info" : {
1317
1312
"avatar" : null,
1318
1313
"canonical_alias" : null,
@@ -1507,7 +1502,7 @@ mod tests {
1507
1502
assert_eq ! ( info. last_prev_batch, Some ( "pb" . to_owned( ) ) ) ;
1508
1503
assert_eq ! ( info. sync_info, SyncInfo :: FullySynced ) ;
1509
1504
assert ! ( info. encryption_state_synced) ;
1510
- assert_matches ! ( info. new_latest_event , LatestEventValue :: None ) ;
1505
+ assert_matches ! ( info. latest_event_value , LatestEventValue :: None ) ;
1511
1506
assert ! ( info. base_info. avatar. is_none( ) ) ;
1512
1507
assert ! ( info. base_info. canonical_alias. is_none( ) ) ;
1513
1508
assert ! ( info. base_info. create. is_none( ) ) ;
0 commit comments