fix: Correct relations pagination and recursion

Ended up rewriting a fair bit, but should work better.
This commit is contained in:
Henry-Hiles authored and Ellis Git committed 2026-11-08 19:34:25 +00:00
1 parent 7c451888ae
commit 15b4e8e2f9
7 files changed
+232 -201

No files matched your search

+10 -5
View File
@@ -8,7 +8,7 @@ pub trait RelationTypeEqual<E: Event> {
}
#[derive(Clone, Debug, Deserialize)]
struct ExtractRelatesToEventId {
struct ExtractRelatesToRelType {
#[serde(rename = "m.relates_to")]
relates_to: ExtractRelType,
}
@@ -18,11 +18,16 @@ struct ExtractRelType {
rel_type: RelationType,
}
/// The type of an event's relation, if it has one
pub fn relation_type<E: Event>(event: &E) -> Option<RelationType> {
event
.get_content()
.map(|c: ExtractRelatesToRelType| c.relates_to.rel_type)
.ok()
}
impl<E: Event> RelationTypeEqual<E> for RelationType {
fn relation_type_equal(&self, event: &E) -> bool {
event
.get_content()
.map(|c: ExtractRelatesToEventId| c.relates_to.rel_type)
.is_ok_and(|r| r == *self)
relation_type(event).is_some_and(|r| r == *self)
}
}