Add relations endpoints, edits and threads work now

This commit is contained in:
Timo Kösters 2023-06-26 12:38:51 +02:00
parent db6def8800
commit 72eb1972c1
No known key found for this signature in database
GPG key ID: 0B25E636FBA7E4CB
8 changed files with 385 additions and 29 deletions

View file

@ -478,10 +478,16 @@ impl Service {
}
if let Ok(content) = serde_json::from_str::<ExtractRelatesToEventId>(pdu.content.get()) {
services()
if let Some(related_pducount) = services()
.rooms
.pdu_metadata
.add_relation(&pdu.event_id, &content.relates_to.event_id)?;
.timeline
.get_pdu_count(&content.relates_to.event_id)?
{
services()
.rooms
.pdu_metadata
.add_relation(PduCount::Normal(count2), related_pducount)?;
}
}
if let Ok(content) = serde_json::from_str::<ExtractRelatesTo>(pdu.content.get()) {
@ -489,10 +495,16 @@ impl Service {
Relation::Reply { in_reply_to } => {
// We need to do it again here, because replies don't have
// event_id as a top level field
services()
if let Some(related_pducount) = services()
.rooms
.pdu_metadata
.add_relation(&pdu.event_id, &in_reply_to.event_id)?;
.timeline
.get_pdu_count(&in_reply_to.event_id)?
{
services()
.rooms
.pdu_metadata
.add_relation(PduCount::Normal(count2), related_pducount)?;
}
}
Relation::Thread(thread) => {
services()