@@ -91,13 +91,23 @@ async def _received_remote_receipt(self, origin: str, content: JsonDict) -> None
9191 )
9292 continue
9393
94+ # Check if these receipts apply to a thread.
95+ thread_id = None
96+ data = user_values .get ("data" , {})
97+ if isinstance (data , dict ):
98+ thread_id = data .get ("thread_id" )
99+ # If the thread ID is invalid, consider it missing.
100+ if not isinstance (thread_id , str ):
101+ thread_id = None
102+
94103 receipts .append (
95104 ReadReceipt (
96105 room_id = room_id ,
97106 receipt_type = receipt_type ,
98107 user_id = user_id ,
99108 event_ids = user_values ["event_ids" ],
100- data = user_values .get ("data" , {}),
109+ thread_id = thread_id ,
110+ data = data ,
101111 )
102112 )
103113
@@ -146,7 +156,12 @@ async def _handle_new_receipts(self, receipts: List[ReadReceipt]) -> bool:
146156 return True
147157
148158 async def received_client_receipt (
149- self , room_id : str , receipt_type : str , user_id : str , event_id : str
159+ self ,
160+ room_id : str ,
161+ receipt_type : str ,
162+ user_id : str ,
163+ event_id : str ,
164+ thread_id : Optional [str ],
150165 ) -> None :
151166 """Called when a client tells us a local user has read up to the given
152167 event_id in the room.
@@ -156,6 +171,7 @@ async def received_client_receipt(
156171 receipt_type = receipt_type ,
157172 user_id = user_id ,
158173 event_ids = [event_id ],
174+ thread_id = thread_id ,
159175 data = {"ts" : int (self .clock .time_msec ())},
160176 )
161177
0 commit comments