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())
|
.map(|(_, pdu)| pdu.to_room_event())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut resp = get_context::Response::new();
|
let resp = get_context::Response {
|
||||||
resp.start = start_token;
|
start: start_token,
|
||||||
resp.end = end_token;
|
end: end_token,
|
||||||
resp.events_before = events_before;
|
events_before,
|
||||||
resp.event = Some(base_event);
|
event: Some(base_event),
|
||||||
resp.events_after = events_after;
|
events_after,
|
||||||
resp.state = db // TODO: State at event
|
state: db // TODO: State at event
|
||||||
.rooms
|
.rooms
|
||||||
.room_state_full(&body.room_id)?
|
.room_state_full(&body.room_id)?
|
||||||
.values()
|
.values()
|
||||||
.map(|pdu| pdu.to_state_event())
|
.map(|pdu| pdu.to_state_event())
|
||||||
.collect();
|
.collect(),
|
||||||
|
};
|
||||||
|
|
||||||
Ok(resp.into())
|
Ok(resp.into())
|
||||||
}
|
}
|
||||||
|
@ -159,11 +159,12 @@ pub async fn get_message_events_route(
|
|||||||
.map(|(_, pdu)| pdu.to_room_event())
|
.map(|(_, pdu)| pdu.to_room_event())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut resp = get_message_events::Response::new();
|
let resp = get_message_events::Response {
|
||||||
resp.start = body.from.to_owned();
|
start: body.from.to_owned(),
|
||||||
resp.end = end_token;
|
end: end_token,
|
||||||
resp.chunk = events_after;
|
chunk: events_after,
|
||||||
resp.state = Vec::new();
|
state: Vec::new(),
|
||||||
|
};
|
||||||
|
|
||||||
Ok(resp.into())
|
Ok(resp.into())
|
||||||
}
|
}
|
||||||
@ -189,11 +190,12 @@ pub async fn get_message_events_route(
|
|||||||
.map(|(_, pdu)| pdu.to_room_event())
|
.map(|(_, pdu)| pdu.to_room_event())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut resp = get_message_events::Response::new();
|
let resp = get_message_events::Response {
|
||||||
resp.start = body.from.to_owned();
|
start: body.from.to_owned(),
|
||||||
resp.end = start_token;
|
end: start_token,
|
||||||
resp.chunk = events_before;
|
chunk: events_before,
|
||||||
resp.state = Vec::new();
|
state: Vec::new(),
|
||||||
|
};
|
||||||
|
|
||||||
Ok(resp.into())
|
Ok(resp.into())
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,10 @@ use rocket::get;
|
|||||||
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/versions"))]
|
#[cfg_attr(feature = "conduit_bin", get("/_matrix/client/versions"))]
|
||||||
#[tracing::instrument]
|
#[tracing::instrument]
|
||||||
pub async fn get_supported_versions_route() -> ConduitResult<get_supported_versions::Response> {
|
pub async fn get_supported_versions_route() -> ConduitResult<get_supported_versions::Response> {
|
||||||
let mut resp =
|
let resp = get_supported_versions::Response {
|
||||||
get_supported_versions::Response::new(vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()]);
|
versions: vec!["r0.5.0".to_owned(), "r0.6.0".to_owned()],
|
||||||
|
unstable_features: [("org.matrix.e2e_cross_signing".to_owned(), true)].into(),
|
||||||
resp.unstable_features
|
};
|
||||||
.insert("org.matrix.e2e_cross_signing".to_owned(), true);
|
|
||||||
|
|
||||||
Ok(resp.into())
|
Ok(resp.into())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user