perf: Strip unsigned over federation and generate it on the fly locally

This commit is contained in:
timedout committed 2026-09-27 17:32:46 +01:00
1 parent 286897de88
commit b2072baf59
14 files changed
+263 -79

No files matched your search

+6 -1
View File
@@ -58,7 +58,12 @@ pub(crate) async fn get_room_event_route(
debug_warn!("Failed to add bundled aggregations to event: {e}");
}
event.set_unsigned(Some(body.identity.expect_sender_user()?));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&event, Some(sender_user))
.await;
event.set_unsigned(ctx.user_id, ctx.membership, ctx.prev_content, ctx.redacted_because);
Ok(get_room_event::v3::Response::new(event.into_format()))
}
+11 -1
View File
@@ -53,7 +53,17 @@ pub(crate) async fn room_initial_sync_route(
.pdus_rev(room_id, None)
.try_take(limit)
.and_then(async |mut pdu| {
pdu.1.set_unsigned(Some(sender_user));
let ctx = services
.rooms
.timeline
.get_unsigned_context(&pdu.1, Some(sender_user))
.await;
pdu.1.set_unsigned(
ctx.user_id,
ctx.membership,
ctx.prev_content,
ctx.redacted_because,
);
if let Err(e) = services
.rooms
.pdu_metadata