Add room_version argument and reorg convert_outgoing_federation_event.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user