@@ -279,35 +279,35 @@ impl SpaceService {
279279 if space_room
280280 . get_state_event_static_for_key :: < SpaceChildEventContent , _ > ( & child_id)
281281 . await
282- . is_err ( )
282+ . is_ok ( )
283283 {
284+ // Redacting state is a "weird" thing to do, so send {} instead.
285+ // https://github.com/matrix-org/matrix-spec/issues/2252
286+ //
287+ // Specifically, "The redaction of the state doesn't participate in state
288+ // resolution so behaves quite differently from e.g. sending an empty form of
289+ // that state events".
290+ space_room
291+ . send_state_event_raw ( "m.space.child" , child_id. as_str ( ) , serde_json:: json!( { } ) )
292+ . await
293+ . map_err ( Error :: UpdateRelationship ) ?;
294+ } else {
284295 warn ! ( "A space child event wasn't found on the parent, ignoring." ) ;
285- return Ok ( ( ) ) ;
286296 }
287- // Redacting state is a "weird" thing to do, so send {} instead.
288- // https://github.com/matrix-org/matrix-spec/issues/2252
289- //
290- // Specifically, "The redaction of the state doesn't participate in state
291- // resolution so behaves quite differently from e.g. sending an empty form of
292- // that state events".
293- space_room
294- . send_state_event_raw ( "m.space.child" , child_id. as_str ( ) , serde_json:: json!( { } ) )
295- . await
296- . map_err ( Error :: UpdateRelationship ) ?;
297297
298298 if child_room
299299 . get_state_event_static_for_key :: < SpaceParentEventContent , _ > ( & space_id)
300300 . await
301- . is_err ( )
301+ . is_ok ( )
302302 {
303+ // Same as the comment above.
304+ child_room
305+ . send_state_event_raw ( "m.space.parent" , space_id. as_str ( ) , serde_json:: json!( { } ) )
306+ . await
307+ . map_err ( Error :: UpdateRelationship ) ?;
308+ } else {
303309 warn ! ( "A space parent event wasn't found on the child, ignoring." ) ;
304- return Ok ( ( ) ) ;
305310 }
306- // Same as the comment above.
307- child_room
308- . send_state_event_raw ( "m.space.parent" , space_id. as_str ( ) , serde_json:: json!( { } ) )
309- . await
310- . map_err ( Error :: UpdateRelationship ) ?;
311311
312312 Ok ( ( ) )
313313 }
0 commit comments