@@ -554,7 +554,7 @@ impl RoomEventCacheInner {
554
554
555
555
room_events. push_events ( events. clone ( ) ) ;
556
556
557
- EventsPostProcessing :: HaveBeenInserted ( events. clone ( ) )
557
+ events. clone ( )
558
558
} )
559
559
. await ?;
560
560
@@ -676,8 +676,7 @@ mod private {
676
676
EventCacheError ,
677
677
} ,
678
678
events:: RoomEvents ,
679
- sort_positions_descending, EventLocation , EventsPostProcessing ,
680
- LoadMoreEventsBackwardsOutcome ,
679
+ sort_positions_descending, EventLocation , LoadMoreEventsBackwardsOutcome ,
681
680
} ;
682
681
use crate :: event_cache:: RoomPaginationStatus ;
683
682
@@ -1102,7 +1101,7 @@ mod private {
1102
1101
)
1103
1102
. expect ( "failed to remove an event" ) ;
1104
1103
1105
- EventsPostProcessing :: None
1104
+ vec ! [ ]
1106
1105
} )
1107
1106
. await ?;
1108
1107
@@ -1226,27 +1225,26 @@ mod private {
1226
1225
///
1227
1226
/// Returns the updates to the linked chunk, as vector diffs, so the
1228
1227
/// caller may propagate such updates, if needs be.
1228
+ ///
1229
+ /// The function `func` takes a mutable reference to `RoomEvents`. It
1230
+ /// returns a set of events that will be post-processed. At the time of
1231
+ /// writing, all these events are passed to
1232
+ /// `Self::maybe_apply_new_redaction`.
1229
1233
#[ must_use = "Updates as `VectorDiff` must probably be propagated via `RoomEventCacheUpdate`" ]
1230
1234
pub async fn with_events_mut < F > (
1231
1235
& mut self ,
1232
1236
func : F ,
1233
1237
) -> Result < Vec < VectorDiff < TimelineEvent > > , EventCacheError >
1234
1238
where
1235
- F : FnOnce ( & mut RoomEvents ) -> EventsPostProcessing ,
1239
+ F : FnOnce ( & mut RoomEvents ) -> Vec < TimelineEvent > ,
1236
1240
{
1237
- let post_processing = func ( & mut self . events ) ;
1241
+ let events_to_post_process = func ( & mut self . events ) ;
1238
1242
1239
1243
// Update the store before doing the post-processing.
1240
1244
self . propagate_changes ( ) . await ?;
1241
1245
1242
- match post_processing {
1243
- EventsPostProcessing :: HaveBeenInserted ( events) => {
1244
- for event in & events {
1245
- self . maybe_apply_new_redaction ( event) . await ?;
1246
- }
1247
- }
1248
-
1249
- EventsPostProcessing :: None => { }
1246
+ for event in & events_to_post_process {
1247
+ self . maybe_apply_new_redaction ( event) . await ?;
1250
1248
}
1251
1249
1252
1250
// If we've never waited for an initial previous-batch token, and we now have at
@@ -1353,15 +1351,6 @@ mod private {
1353
1351
}
1354
1352
}
1355
1353
1356
- /// Output of the callback passed to `RoomEventCacheState::with_events_mut`.
1357
- pub ( super ) enum EventsPostProcessing {
1358
- /// Trigger the post-processing when new events have been inserted.
1359
- HaveBeenInserted ( Vec < TimelineEvent > ) ,
1360
-
1361
- /// No post-processing.
1362
- None ,
1363
- }
1364
-
1365
1354
/// An enum representing where an event has been found.
1366
1355
pub ( super ) enum EventLocation {
1367
1356
/// Event lives in memory (and likely in the store!).
0 commit comments