@@ -232,53 +232,6 @@ impl RoomDataProvider for Room {
232232 event_id : & ' a EventId ,
233233 receipt_thread : ReceiptThread ,
234234 ) -> IndexMap < OwnedUserId , Receipt > {
235- if matches ! ( receipt_thread, ReceiptThread :: Unthreaded | ReceiptThread :: Main ) {
236- // If the requested receipt thread is unthreaded or main, we maintain maximal
237- // compatibility with clients using either unthreaded or main-thread read
238- // receipts by allowing both here.
239-
240- // First, load the main receipts.
241- let mut result = match self
242- . load_event_receipts ( ReceiptType :: Read , ReceiptThread :: Main , event_id)
243- . await
244- {
245- Ok ( receipts) => receipts. into_iter ( ) . collect ( ) ,
246- Err ( e) => {
247- error ! ( ?event_id, "Failed to get main thread read receipts for event: {e}" ) ;
248- IndexMap :: new ( )
249- }
250- } ;
251-
252- // Then, load the unthreaded receipts.
253- let unthreaded_receipts = match self
254- . load_event_receipts ( ReceiptType :: Read , ReceiptThread :: Unthreaded , event_id)
255- . await
256- {
257- Ok ( receipts) => receipts,
258- Err ( e) => {
259- error ! ( ?event_id, "Failed to get main thread read receipts for event: {e}" ) ;
260- Vec :: new ( )
261- }
262- } ;
263-
264- // Only insert unthreaded receipts that are more recent. Ideally we'd compare
265- // the receipted event position, but we don't have access to that
266- // here.
267- for ( user_id, unthreaded_receipt) in unthreaded_receipts {
268- if let Some ( main_receipt) = result. get ( & user_id) {
269- if unthreaded_receipt. ts > main_receipt. ts {
270- result. insert ( user_id, unthreaded_receipt) ;
271- }
272- } else {
273- result. insert ( user_id, unthreaded_receipt) ;
274- }
275- }
276-
277- return result;
278- }
279-
280- // In all other cases, return what's requested, and only that (threaded
281- // receipts).
282235 match self . load_event_receipts ( ReceiptType :: Read , receipt_thread. clone ( ) , event_id) . await {
283236 Ok ( receipts) => receipts. into_iter ( ) . collect ( ) ,
284237 Err ( e) => {
0 commit comments