mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-15 13:16:56 +00:00
fix(spaces): Honour suggested_only when listing children_state
This commit is contained in:
1 parent
224710e0fb
commit
2d633a5ee1
2 files changed
+8
-4
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
Fixed the space hierarchy endpoints returning non-suggested `m.space.child` events in `children_state` when `suggested_only` was requested. Contributed by @eleboucher.
|
||||||
@@ -127,7 +127,7 @@ impl Service {
|
|||||||
let (mut summary, inaccessible_children) = {
|
let (mut summary, inaccessible_children) = {
|
||||||
if let Some(summary) = self.build_local_room_summary(room_id).await {
|
if let Some(summary) = self.build_local_room_summary(room_id).await {
|
||||||
// We have this room locally.
|
// We have this room locally.
|
||||||
let children_state = self.get_space_child_events(room_id).await;
|
let children_state = self.get_space_child_events(room_id, suggested_only).await;
|
||||||
|
|
||||||
// All of the room's children are accessible to this server (because we have the
|
// All of the room's children are accessible to this server (because we have the
|
||||||
// full room and its state), although some of them may not be accessible to
|
// full room and its state), although some of them may not be accessible to
|
||||||
@@ -315,7 +315,7 @@ impl Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let children_state = if matches!(summary.room_type.as_ref(), Some(RoomType::Space)) {
|
let children_state = if matches!(summary.room_type.as_ref(), Some(RoomType::Space)) {
|
||||||
self.get_space_child_events(room_id).await
|
self.get_space_child_events(room_id, suggested_only).await
|
||||||
} else {
|
} else {
|
||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
@@ -324,8 +324,6 @@ impl Service {
|
|||||||
.iter()
|
.iter()
|
||||||
// Ignore deserialization failures
|
// Ignore deserialization failures
|
||||||
.flat_map(Raw::deserialize)
|
.flat_map(Raw::deserialize)
|
||||||
// Filter out non-suggested children if suggested_only is set
|
|
||||||
.filter(|child| !suggested_only || child.content.suggested)
|
|
||||||
// Fetch summaries for the children in parallel
|
// Fetch summaries for the children in parallel
|
||||||
.stream()
|
.stream()
|
||||||
.broad_then(async |child| {
|
.broad_then(async |child| {
|
||||||
@@ -490,6 +488,7 @@ impl Service {
|
|||||||
async fn get_space_child_events(
|
async fn get_space_child_events(
|
||||||
&self,
|
&self,
|
||||||
room_id: &RoomId,
|
room_id: &RoomId,
|
||||||
|
suggested_only: bool,
|
||||||
) -> Vec<Raw<HierarchySpaceChildEvent>> {
|
) -> Vec<Raw<HierarchySpaceChildEvent>> {
|
||||||
let current_shortstatehash = self
|
let current_shortstatehash = self
|
||||||
.services
|
.services
|
||||||
@@ -518,6 +517,10 @@ impl Service {
|
|||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if suggested_only && !content.suggested {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
if RoomId::parse(&state_key).is_err() {
|
if RoomId::parse(&state_key).is_err() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user