fix: various improvements and fixes

This commit is contained in:
Timo Kösters
2021-03-23 12:59:27 +01:00
parent 363c629faf
commit 3ea7d162db
9 changed files with 67 additions and 57 deletions

View File

@@ -24,20 +24,25 @@ pub async fn get_context_route(
));
}
let base_pdu_id = db
.rooms
.get_pdu_id(&body.event_id)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"Base event id not found.",
))?;
let base_token = db.rooms.pdu_count(&base_pdu_id)?;
let base_event = db
.rooms
.get_pdu(&body.event_id)?
.get_pdu_from_id(&base_pdu_id)?
.ok_or(Error::BadRequest(
ErrorKind::NotFound,
"Base event not found.",
))?
.to_room_event();
let base_token = db
.rooms
.get_pdu_count(&body.event_id)?
.expect("event still exists");
let events_before = db
.rooms
.pdus_until(&sender_user, &body.room_id, base_token)