Refactor room version support, add default room version config
This commit is contained in:
parent
d81216cad7
commit
714873694d
7 changed files with 96 additions and 28 deletions
|
@ -2639,9 +2639,12 @@ pub async fn create_join_event_template_route(
|
|||
})
|
||||
.transpose()?;
|
||||
|
||||
// If there was no create event yet, assume we are creating a version 6 room right now
|
||||
let room_version_id =
|
||||
create_event_content.map_or(RoomVersionId::V6, |create_event| create_event.room_version);
|
||||
// If there was no create event yet, assume we are creating a room with the default version
|
||||
// right now
|
||||
let room_version_id = create_event_content
|
||||
.map_or(db.globals.default_room_version(), |create_event| {
|
||||
create_event.room_version
|
||||
});
|
||||
let room_version = RoomVersion::new(&room_version_id).expect("room version is supported");
|
||||
|
||||
if !body.ver.contains(&room_version_id) {
|
||||
|
@ -2943,7 +2946,7 @@ pub async fn create_invite_route(
|
|||
|
||||
acl_check(sender_servername, &body.room_id, &db)?;
|
||||
|
||||
if body.room_version != RoomVersionId::V5 && body.room_version != RoomVersionId::V6 {
|
||||
if !db.rooms.is_supported_version(&db, &body.room_version) {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::IncompatibleRoomVersion {
|
||||
room_version: body.room_version.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue