@@ -567,7 +567,7 @@ impl RoomEventCacheInner {
567
567
568
568
room_events. push_events ( events. clone ( ) ) ;
569
569
570
- EventsPostProcessing :: HaveBeenInserted ( events. clone ( ) )
570
+ events. clone ( )
571
571
} )
572
572
. await ?;
573
573
@@ -689,8 +689,7 @@ mod private {
689
689
EventCacheError ,
690
690
} ,
691
691
events:: RoomEvents ,
692
- sort_positions_descending, EventLocation , EventsPostProcessing ,
693
- LoadMoreEventsBackwardsOutcome ,
692
+ sort_positions_descending, EventLocation , LoadMoreEventsBackwardsOutcome ,
694
693
} ;
695
694
use crate :: event_cache:: RoomPaginationStatus ;
696
695
@@ -1121,7 +1120,7 @@ mod private {
1121
1120
)
1122
1121
. expect ( "failed to remove an event" ) ;
1123
1122
1124
- EventsPostProcessing :: None
1123
+ vec ! [ ]
1125
1124
} )
1126
1125
. await ?;
1127
1126
@@ -1256,27 +1255,26 @@ mod private {
1256
1255
///
1257
1256
/// Returns the updates to the linked chunk, as vector diffs, so the
1258
1257
/// caller may propagate such updates, if needs be.
1258
+ ///
1259
+ /// The function `func` takes a mutable reference to `RoomEvents`. It
1260
+ /// returns a set of events that will be post-processed. At the time of
1261
+ /// writing, all these events are passed to
1262
+ /// `Self::maybe_apply_new_redaction`.
1259
1263
#[ must_use = "Updates as `VectorDiff` must probably be propagated via `RoomEventCacheUpdate`" ]
1260
1264
pub async fn with_events_mut < F > (
1261
1265
& mut self ,
1262
1266
func : F ,
1263
1267
) -> Result < Vec < VectorDiff < TimelineEvent > > , EventCacheError >
1264
1268
where
1265
- F : FnOnce ( & mut RoomEvents ) -> EventsPostProcessing ,
1269
+ F : FnOnce ( & mut RoomEvents ) -> Vec < TimelineEvent > ,
1266
1270
{
1267
- let post_processing = func ( & mut self . events ) ;
1271
+ let events_to_post_process = func ( & mut self . events ) ;
1268
1272
1269
1273
// Update the store before doing the post-processing.
1270
1274
self . propagate_changes ( ) . await ?;
1271
1275
1272
- match post_processing {
1273
- EventsPostProcessing :: HaveBeenInserted ( events) => {
1274
- for event in & events {
1275
- self . maybe_apply_new_redaction ( event) . await ?;
1276
- }
1277
- }
1278
-
1279
- EventsPostProcessing :: None => { }
1276
+ for event in & events_to_post_process {
1277
+ self . maybe_apply_new_redaction ( event) . await ?;
1280
1278
}
1281
1279
1282
1280
// If we've never waited for an initial previous-batch token, and we now have at
@@ -1383,15 +1381,6 @@ mod private {
1383
1381
}
1384
1382
}
1385
1383
1386
- /// Output of the callback passed to `RoomEventCacheState::with_events_mut`.
1387
- pub ( super ) enum EventsPostProcessing {
1388
- /// Trigger the post-processing when new events have been inserted.
1389
- HaveBeenInserted ( Vec < TimelineEvent > ) ,
1390
-
1391
- /// No post-processing.
1392
- None ,
1393
- }
1394
-
1395
1384
/// An enum representing where an event has been found.
1396
1385
pub ( super ) enum EventLocation {
1397
1386
/// Event lives in memory (and likely in the store!).
0 commit comments