Implement From<AnyInitialStateEvent> on PduBuilder
The conversion between the two is now direct and thus shouldn't lose the state_keys.
This commit is contained in:
parent
7d14a46607
commit
666e1d30a3
2 changed files with 20 additions and 7 deletions
|
@ -233,10 +233,9 @@ pub async fn create_room_route(
|
|||
|
||||
// 5. Events listed in initial_state
|
||||
for event in &body.initial_state {
|
||||
let pdu_builder = serde_json::from_str::<PduBuilder>(
|
||||
&serde_json::to_string(&event).expect("AnyInitialStateEvent::to_string always works"),
|
||||
)
|
||||
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Invalid initial state event."))?;
|
||||
let pdu_builder = PduBuilder::from(event.deserialize().map_err(|_| {
|
||||
Error::BadRequest(ErrorKind::InvalidParam, "Invalid initial state event.")
|
||||
})?);
|
||||
|
||||
// Silently skip encryption events if they are not allowed
|
||||
if pdu_builder.event_type == EventType::RoomEncryption && !db.globals.allow_encryption() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue