mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-14 04:37:00 +00:00
fix: Correct relations pagination and recursion
Ended up rewriting a fair bit, but should work better.
This commit is contained in:
1 parent
7c451888ae
commit
15b4e8e2f9
7 files changed
+232
-201
No files matched your search
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user