@@ -21,16 +21,17 @@ use eyeball_im_util::vector::{FilterMap, VectorObserverExt};
21
21
use futures_core:: Stream ;
22
22
use imbl:: Vector ;
23
23
#[ cfg( test) ]
24
- use matrix_sdk:: crypto :: OlmMachine ;
24
+ use matrix_sdk:: Result ;
25
25
use matrix_sdk:: {
26
- Result , Room ,
27
26
deserialized_responses:: TimelineEvent ,
28
27
event_cache:: { RoomEventCache , RoomPaginationStatus } ,
29
28
paginators:: { PaginationResult , Paginator } ,
30
29
send_queue:: {
31
30
LocalEcho , LocalEchoContent , RoomSendQueueUpdate , SendHandle , SendReactionHandle ,
32
31
} ,
33
32
} ;
33
+ #[ cfg( test) ]
34
+ use ruma:: events:: receipt:: ReceiptEventContent ;
34
35
use ruma:: {
35
36
EventId , MilliSecondsSinceUnixEpoch , OwnedEventId , OwnedTransactionId , TransactionId , UserId ,
36
37
api:: client:: receipt:: create_receipt:: v3:: ReceiptType as SendReceiptType ,
@@ -46,8 +47,6 @@ use ruma::{
46
47
room_version_rules:: RoomVersionRules ,
47
48
serde:: Raw ,
48
49
} ;
49
- #[ cfg( test) ]
50
- use ruma:: { OwnedRoomId , RoomId , events:: receipt:: ReceiptEventContent } ;
51
50
use tokio:: sync:: { RwLock , RwLockWriteGuard } ;
52
51
use tracing:: { debug, error, field:: debug, info, instrument, trace, warn} ;
53
52
@@ -68,11 +67,11 @@ use super::{
68
67
event_item:: { ReactionStatus , RemoteEventOrigin } ,
69
68
item:: TimelineUniqueId ,
70
69
subscriber:: TimelineSubscriber ,
71
- traits:: { Decryptor , RoomDataProvider } ,
70
+ traits:: RoomDataProvider ,
72
71
} ;
73
72
use crate :: {
74
73
timeline:: {
75
- MsgLikeContent , MsgLikeKind , TimelineEventFilterFn ,
74
+ MsgLikeContent , MsgLikeKind , Room , TimelineEventFilterFn ,
76
75
algorithms:: rfind_event_by_item_id,
77
76
date_dividers:: DateDividerAdjuster ,
78
77
event_item:: TimelineItemHandle ,
@@ -152,7 +151,7 @@ impl<P: RoomDataProvider> TimelineFocusKind<P> {
152
151
}
153
152
154
153
#[ derive( Clone , Debug ) ]
155
- pub ( super ) struct TimelineController < P : RoomDataProvider = Room , D : Decryptor = Room > {
154
+ pub ( super ) struct TimelineController < P : RoomDataProvider = Room > {
156
155
/// Inner mutable state.
157
156
state : Arc < RwLock < TimelineState < P > > > ,
158
157
@@ -161,15 +160,15 @@ pub(super) struct TimelineController<P: RoomDataProvider = Room, D: Decryptor =
161
160
162
161
/// A [`RoomDataProvider`] implementation, providing data.
163
162
///
164
- /// Useful for testing only; in the real world, it's just a [`Room`].
163
+ /// In the real world, this is just a [`Room`].
165
164
pub ( crate ) room_data_provider : P ,
166
165
167
166
/// Settings applied to this timeline.
168
167
pub ( super ) settings : TimelineSettings ,
169
168
170
169
/// Long-running task used to retry decryption of timeline items without
171
170
/// blocking main processing.
172
- decryption_retry_task : DecryptionRetryTask < P , D > ,
171
+ decryption_retry_task : DecryptionRetryTask < P , P > ,
173
172
}
174
173
175
174
#[ derive( Clone ) ]
@@ -290,7 +289,7 @@ pub fn default_event_filter(event: &AnySyncTimelineEvent, rules: &RoomVersionRul
290
289
}
291
290
}
292
291
293
- impl < P : RoomDataProvider , D : Decryptor > TimelineController < P , D > {
292
+ impl < P : RoomDataProvider > TimelineController < P > {
294
293
pub ( super ) fn new (
295
294
room_data_provider : P ,
296
295
focus : TimelineFocus ,
@@ -1099,12 +1098,10 @@ impl<P: RoomDataProvider, D: Decryptor> TimelineController<P, D> {
1099
1098
true
1100
1099
}
1101
1100
1102
- async fn retry_event_decryption_inner (
1103
- & self ,
1104
- decryptor : D ,
1105
- session_ids : Option < BTreeSet < String > > ,
1106
- ) {
1107
- self . decryption_retry_task . decrypt ( decryptor, session_ids, self . settings . clone ( ) ) . await ;
1101
+ pub ( crate ) async fn retry_event_decryption_inner ( & self , session_ids : Option < BTreeSet < String > > ) {
1102
+ self . decryption_retry_task
1103
+ . decrypt ( self . room_data_provider . clone ( ) , session_ids, self . settings . clone ( ) )
1104
+ . await ;
1108
1105
}
1109
1106
1110
1107
pub ( super ) async fn set_sender_profiles_pending ( & self ) {
@@ -1246,7 +1243,7 @@ impl<P: RoomDataProvider, D: Decryptor> TimelineController<P, D> {
1246
1243
/// Subscribe to changes in the read receipts of our own user.
1247
1244
pub async fn subscribe_own_user_read_receipts_changed (
1248
1245
& self ,
1249
- ) -> impl Stream < Item = ( ) > + use < P , D > {
1246
+ ) -> impl Stream < Item = ( ) > + use < P > {
1250
1247
self . state . read ( ) . await . meta . read_receipts . subscribe_own_user_read_receipts_changed ( )
1251
1248
}
1252
1249
@@ -1591,7 +1588,7 @@ impl TimelineController {
1591
1588
1592
1589
#[ instrument( skip( self ) , fields( room_id = ?self . room( ) . room_id( ) ) ) ]
1593
1590
pub ( super ) async fn retry_event_decryption ( & self , session_ids : Option < BTreeSet < String > > ) {
1594
- self . retry_event_decryption_inner ( self . room ( ) . clone ( ) , session_ids) . await
1591
+ self . retry_event_decryption_inner ( session_ids) . await
1595
1592
}
1596
1593
1597
1594
/// Combine the global (event cache) pagination status with the local state
@@ -1625,18 +1622,6 @@ impl TimelineController {
1625
1622
}
1626
1623
}
1627
1624
1628
- #[ cfg( test) ]
1629
- impl < P : RoomDataProvider > TimelineController < P , ( OlmMachine , OwnedRoomId ) > {
1630
- pub ( super ) async fn retry_event_decryption_test (
1631
- & self ,
1632
- room_id : & RoomId ,
1633
- olm_machine : OlmMachine ,
1634
- session_ids : Option < BTreeSet < String > > ,
1635
- ) {
1636
- self . retry_event_decryption_inner ( ( olm_machine, room_id. to_owned ( ) ) , session_ids) . await
1637
- }
1638
- }
1639
-
1640
1625
#[ allow( clippy:: too_many_arguments) ]
1641
1626
async fn fetch_replied_to_event < P : RoomDataProvider > (
1642
1627
mut state_guard : RwLockWriteGuard < ' _ , TimelineState < P > > ,
0 commit comments