From d5f09dffaae6ebe52a2b2278d37dd0084c58ffc0 Mon Sep 17 00:00:00 2001 From: Doug Date: Mon, 24 Nov 2025 13:04:12 +0000 Subject: [PATCH] spaces: Fix an incorrect early return introduced at the last minute. --- crates/matrix-sdk-ui/src/spaces/mod.rs | 38 +++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/crates/matrix-sdk-ui/src/spaces/mod.rs b/crates/matrix-sdk-ui/src/spaces/mod.rs index d07d08637..8ca44ec86 100644 --- a/crates/matrix-sdk-ui/src/spaces/mod.rs +++ b/crates/matrix-sdk-ui/src/spaces/mod.rs @@ -279,35 +279,35 @@ impl SpaceService { if space_room .get_state_event_static_for_key::(&child_id) .await - .is_err() + .is_ok() { + // Redacting state is a "weird" thing to do, so send {} instead. + // https://github.com/matrix-org/matrix-spec/issues/2252 + // + // Specifically, "The redaction of the state doesn't participate in state + // resolution so behaves quite differently from e.g. sending an empty form of + // that state events". + space_room + .send_state_event_raw("m.space.child", child_id.as_str(), serde_json::json!({})) + .await + .map_err(Error::UpdateRelationship)?; + } else { warn!("A space child event wasn't found on the parent, ignoring."); - return Ok(()); } - // Redacting state is a "weird" thing to do, so send {} instead. - // https://github.com/matrix-org/matrix-spec/issues/2252 - // - // Specifically, "The redaction of the state doesn't participate in state - // resolution so behaves quite differently from e.g. sending an empty form of - // that state events". - space_room - .send_state_event_raw("m.space.child", child_id.as_str(), serde_json::json!({})) - .await - .map_err(Error::UpdateRelationship)?; if child_room .get_state_event_static_for_key::(&space_id) .await - .is_err() + .is_ok() { + // Same as the comment above. + child_room + .send_state_event_raw("m.space.parent", space_id.as_str(), serde_json::json!({})) + .await + .map_err(Error::UpdateRelationship)?; + } else { warn!("A space parent event wasn't found on the child, ignoring."); - return Ok(()); } - // Same as the comment above. - child_room - .send_state_event_raw("m.space.parent", space_id.as_str(), serde_json::json!({})) - .await - .map_err(Error::UpdateRelationship)?; Ok(()) }