mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-17 10:48:18 -07:00
Use struct literals for consistency
This commit is contained in:
parent
349865d3cc
commit
cf54185a1c
@ -92,18 +92,19 @@ pub async fn get_context_route(
|
||||
.map(|(_, pdu)| pdu.to_room_event())
|
||||
.collect();
|
||||
|
||||
let mut resp = get_context::Response::new();
|
||||
resp.start = start_token;
|
||||
resp.end = end_token;
|
||||
resp.events_before = events_before;
|
||||
resp.event = Some(base_event);
|
||||
resp.events_after = events_after;
|
||||
resp.state = db // TODO: State at event
|
||||
.rooms
|
||||
.room_state_full(&body.room_id)?
|
||||
.values()
|
||||
.map(|pdu| pdu.to_state_event())
|
||||
.collect();
|
||||
let resp = get_context::Response {
|
||||
start: start_token,
|
||||
end: end_token,
|
||||
events_before,
|
||||
event: Some(base_event),
|
||||
events_after,
|
||||
state: db // TODO: State at event
|
||||
.rooms
|
||||
.room_state_full(&body.room_id)?
|
||||
.values()
|
||||
.map(|pdu| pdu.to_state_event())
|
||||
.collect(),
|
||||
};
|
||||
|
||||
Ok(resp.into())
|
||||
}
|
||||
|
@ -159,11 +159,12 @@ pub async fn get_message_events_route(
|
||||
.map(|(_, pdu)| pdu.to_room_event())
|
||||
.collect();
|
||||
|
||||
let mut resp = get_message_events::Response::new();
|
||||
resp.start = body.from.to_owned();
|
||||
resp.end = end_token;
|
||||
resp.chunk = events_after;
|
||||
resp.state = Vec::new();
|
||||
let resp = get_message_events::Response {
|
||||
start: body.from.to_owned(),
|
||||
end: end_token,
|
||||
chunk: events_after,
|
||||
state: Vec::new(),
|
||||
};
|
||||
|
||||
Ok(resp.into())
|
||||
}
|
||||
@ -189,11 +190,12 @@ pub async fn get_message_events_route(
|
||||
.map(|(_, pdu)| pdu.to_room_event())
|
||||
.collect();
|
||||
|
||||
let mut resp = get_message_events::Response::new();
|
||||
resp.start = body.from.to_owned();
|
||||
resp.end = start_token;
|
||||
resp.chunk = events_before;
|
||||
resp.state = Vec::new();
|
||||
let resp = get_message_events::Response {
|
||||
start: body.from.to_owned(),
|
||||
end: start_token,
|
||||
chunk: events_before,
|
||||
state: Vec::new(),
|
||||
};
|
||||
|
||||
Ok(resp.into())
|
||||
}
|
||||
|
@ -17,11 +17,10 @@ use rocket::get;
|
||||
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/versions"))]
|
||||
#[tracing::instrument]
|
||||
pub async fn get_supported_versions_route() -> ConduitResult<get_supported_versions::Response> {
|
||||
let mut resp =
|
||||
get_supported_versions::Response::new(vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()]);
|
||||
|
||||
resp.unstable_features
|
||||
.insert("org.matrix.e2e_cross_signing".to_owned(), true);
|
||||
let resp = get_supported_versions::Response {
|
||||
versions: vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()],
|
||||
unstable_features: [("org.matrix.e2e_cross_signing".to_owned(), true)].into(),
|
||||
};
|
||||
|
||||
Ok(resp.into())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user