Add room_version argument and reorg convert_outgoing_federation_event.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk
2025-08-27 06:22:49 +00:00
committed by dasha_uwu
parent 0aea56f02a
commit ce6212b161
16 changed files with 122 additions and 100 deletions

View File

@@ -78,8 +78,8 @@ pub(crate) async fn get_backfill_route(
})
.and_then(|pdu| {
services
.sending
.convert_to_outgoing_federation_event(pdu)
.federation
.format_pdu_into(pdu, None)
.map(Ok)
})
.try_collect()

View File

@@ -41,8 +41,8 @@ pub(crate) async fn get_event_route(
origin: services.globals.server_name().to_owned(),
origin_server_ts: MilliSecondsSinceUnixEpoch::now(),
pdu: services
.sending
.convert_to_outgoing_federation_event(event)
.federation
.format_pdu_into(event, None)
.await,
})
}

View File

@@ -48,11 +48,7 @@ pub(crate) async fn get_event_authorization_route(
.event_ids_iter(room_id, once(body.event_id.borrow()))
.ready_filter_map(Result::ok)
.filter_map(async |id| services.timeline.get_pdu_json(&id).await.ok())
.then(|pdu| {
services
.sending
.convert_to_outgoing_federation_event(pdu)
})
.then(|pdu| services.federation.format_pdu_into(pdu, None))
.collect()
.await;

View File

@@ -77,8 +77,8 @@ pub(crate) async fn get_missing_events_route(
let prev_events = pdu.prev_events.iter().map(ToOwned::to_owned);
let event = services
.sending
.convert_to_outgoing_federation_event(event)
.federation
.format_pdu_into(event, None)
.await;
queued_events.extend(prev_events);

View File

@@ -178,8 +178,8 @@ pub(crate) async fn create_invite_route(
Ok(create_invite::v2::Response {
event: services
.sending
.convert_to_outgoing_federation_event(signed_event)
.federation
.format_pdu_into(signed_event, Some(&body.room_version))
.await,
})
}

View File

@@ -218,8 +218,8 @@ async fn create_join_event(
.broad_and_then(|event_id| services.timeline.get_pdu_json(event_id))
.broad_and_then(|pdu| {
services
.sending
.convert_to_outgoing_federation_event(pdu)
.federation
.format_pdu_into(pdu, Some(&room_version_id))
.map(Ok)
})
.try_collect()
@@ -233,8 +233,8 @@ async fn create_join_event(
.broad_and_then(async |event_id| services.timeline.get_pdu_json(&event_id).await)
.broad_and_then(|pdu| {
services
.sending
.convert_to_outgoing_federation_event(pdu)
.federation
.format_pdu_into(pdu, Some(&room_version_id))
.map(Ok)
})
.try_collect()

View File

@@ -43,8 +43,8 @@ pub(crate) async fn get_room_state_route(
.and_then(|id| services.timeline.get_pdu_json(id))
.and_then(|pdu| {
services
.sending
.convert_to_outgoing_federation_event(pdu)
.federation
.format_pdu_into(pdu, None)
.map(Ok)
})
.try_collect()
@@ -56,8 +56,8 @@ pub(crate) async fn get_room_state_route(
.and_then(async |id| services.timeline.get_pdu_json(&id).await)
.and_then(|pdu| {
services
.sending
.convert_to_outgoing_federation_event(pdu)
.federation
.format_pdu_into(pdu, None)
.map(Ok)
})
.try_collect()