File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
crates/matrix-synapse/src Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,9 @@ struct SynapseDeviceListResponse {
128128#[ derive( Serialize , Deserialize ) ]
129129struct SynapseDevice {
130130 device_id : String ,
131+
132+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
133+ dehydrated : Option < bool > ,
131134}
132135
133136#[ derive( Serialize ) ]
@@ -316,6 +319,7 @@ impl HomeserverConnection for SynapseConnection {
316319 . post ( & format ! ( "_synapse/admin/v2/users/{mxid}/devices" ) )
317320 . json ( & SynapseDevice {
318321 device_id : device_id. to_owned ( ) ,
322+ dehydrated : None ,
319323 } )
320324 . send_traced ( )
321325 . await
@@ -410,8 +414,12 @@ impl HomeserverConnection for SynapseConnection {
410414 . await
411415 . context ( "Failed to parse response while querying devices from Synapse" ) ?;
412416
413- let existing_devices: HashSet < String > =
414- body. devices . into_iter ( ) . map ( |d| d. device_id ) . collect ( ) ;
417+ let existing_devices: HashSet < String > = body
418+ . devices
419+ . into_iter ( )
420+ . filter ( |d| d. dehydrated != Some ( true ) )
421+ . map ( |d| d. device_id )
422+ . collect ( ) ;
415423
416424 // First, delete all the devices that are not needed anymore
417425 let to_delete = existing_devices. difference ( & devices) . cloned ( ) . collect ( ) ;
You can’t perform that action at this time.
0 commit comments