Update ruma version
This commit is contained in:
parent
2a63d0955a
commit
1e8fbd8d50
33 changed files with 147 additions and 169 deletions
|
@ -1,11 +1,10 @@
|
|||
use super::State;
|
||||
use crate::{ConduitResult, Database, Error, Ruma};
|
||||
use js_int::uint;
|
||||
use ruma::api::client::{error::ErrorKind, r0::search::search_events};
|
||||
|
||||
#[cfg(feature = "conduit_bin")]
|
||||
use rocket::post;
|
||||
use search_events::{ResultCategories, ResultRoomEvents, SearchResult};
|
||||
use search_events::{EventContextResult, ResultCategories, ResultRoomEvents, SearchResult};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
#[cfg_attr(
|
||||
|
@ -14,7 +13,7 @@ use std::collections::BTreeMap;
|
|||
)]
|
||||
pub fn search_events_route(
|
||||
db: State<'_, Database>,
|
||||
body: Ruma<search_events::IncomingRequest>,
|
||||
body: Ruma<search_events::Request<'_>>,
|
||||
) -> ConduitResult<search_events::Response> {
|
||||
let sender_id = body.sender_id.as_ref().expect("user is authenticated");
|
||||
|
||||
|
@ -51,13 +50,18 @@ pub fn search_events_route(
|
|||
.0
|
||||
.map(|result| {
|
||||
Ok::<_, Error>(SearchResult {
|
||||
context: None,
|
||||
context: EventContextResult {
|
||||
end: None,
|
||||
events_after: Vec::new(),
|
||||
events_before: Vec::new(),
|
||||
profile_info: BTreeMap::new(),
|
||||
start: None,
|
||||
},
|
||||
rank: None,
|
||||
result: db
|
||||
.rooms
|
||||
.get_pdu_from_id(&result)?
|
||||
// TODO this is an awkward type conversion see method
|
||||
.map(|pdu| pdu.to_any_event()),
|
||||
.map(|pdu| pdu.to_room_event()),
|
||||
})
|
||||
})
|
||||
.filter_map(|r| r.ok())
|
||||
|
@ -72,14 +76,14 @@ pub fn search_events_route(
|
|||
};
|
||||
|
||||
Ok(search_events::Response::new(ResultCategories {
|
||||
room_events: Some(ResultRoomEvents {
|
||||
count: uint!(0), // TODO
|
||||
room_events: ResultRoomEvents {
|
||||
count: None, // TODO? maybe not
|
||||
groups: BTreeMap::new(), // TODO
|
||||
next_batch,
|
||||
results,
|
||||
state: BTreeMap::new(), // TODO
|
||||
highlights: search.1,
|
||||
}),
|
||||
},
|
||||
})
|
||||
.into())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue