remove unnecessary "unsupported room version" error on PDU processing to allow custom room versions properly

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-08-17 02:28:16 -04:00 committed by Jason Volk
parent c40ed0c98e
commit 826b1d1d62
5 changed files with 9 additions and 60 deletions

View file

@ -1,8 +1,7 @@
use std::collections::BTreeMap;
use conduit::{pdu::PduBuilder, warn, Error, Result};
use conduit::{pdu::PduBuilder, Result};
use ruma::{
api::client::error::ErrorKind,
events::{
room::{
canonical_alias::RoomCanonicalAliasEventContent,
@ -45,14 +44,7 @@ pub async fn create_admin_room(services: &Services) -> Result<()> {
use RoomVersionId::*;
match room_version {
V1 | V2 | V3 | V4 | V5 | V6 | V7 | V8 | V9 | V10 => RoomCreateEventContent::new_v1(server_user.clone()),
V11 => RoomCreateEventContent::new_v11(),
_ => {
warn!("Unexpected or unsupported room version {}", room_version);
return Err(Error::BadRequest(
ErrorKind::BadJson,
"Unexpected or unsupported room version found",
));
},
_ => RoomCreateEventContent::new_v11(),
}
};

View file

@ -449,7 +449,7 @@ impl Service {
}
}
},
V11 => {
_ => {
let content =
serde_json::from_str::<RoomRedactionEventContent>(pdu.content.get()).map_err(|e| {
warn!("Invalid content in redaction pdu: {e}");
@ -467,13 +467,6 @@ impl Service {
}
}
},
_ => {
warn!("Unexpected or unsupported room version {room_version_id}");
return Err(Error::BadRequest(
ErrorKind::BadJson,
"Unexpected or unsupported room version found",
));
},
};
},
TimelineEventType::SpaceChild => {