api: Add initial support for Matrix 1.7

This commit is contained in:
Kévin Commaille 2023-05-25 12:57:12 +02:00 committed by Kévin Commaille
parent 631c4e6733
commit dc68190adc
3 changed files with 13 additions and 2 deletions

View File

@ -35,6 +35,7 @@ Improvements:
- `user_can_send_state`
- `user_can_trigger_room_notification`
- Add `MessageType::sanitize` behind the `unstable-sanitize` feature
- Add `MatrixVersion::V1_7`
# 0.11.3

View File

@ -512,6 +512,11 @@ pub enum MatrixVersion {
///
/// See <https://spec.matrix.org/v1.6/>.
V1_6,
/// Version 1.7 of the Matrix specification, released in Q2 2023.
///
/// See <https://spec.matrix.org/v1.7/>.
V1_7,
}
impl TryFrom<&str> for MatrixVersion {
@ -531,6 +536,7 @@ impl TryFrom<&str> for MatrixVersion {
"v1.4" => V1_4,
"v1.5" => V1_5,
"v1.6" => V1_6,
"v1.7" => V1_7,
_ => return Err(UnknownVersionError),
})
}
@ -576,6 +582,7 @@ impl MatrixVersion {
MatrixVersion::V1_4 => (1, 4),
MatrixVersion::V1_5 => (1, 5),
MatrixVersion::V1_6 => (1, 6),
MatrixVersion::V1_7 => (1, 7),
}
}
@ -589,6 +596,7 @@ impl MatrixVersion {
(1, 4) => Ok(MatrixVersion::V1_4),
(1, 5) => Ok(MatrixVersion::V1_5),
(1, 6) => Ok(MatrixVersion::V1_6),
(1, 7) => Ok(MatrixVersion::V1_7),
_ => Err(UnknownVersionError),
}
}
@ -675,7 +683,9 @@ impl MatrixVersion {
// <https://spec.matrix.org/v1.5/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_5 => RoomVersionId::V9,
// <https://spec.matrix.org/v1.6/rooms/#complete-list-of-room-versions>
MatrixVersion::V1_6 => RoomVersionId::V10,
MatrixVersion::V1_6
// <https://spec.matrix.org/v1.7/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_7 => RoomVersionId::V10,
}
}
}

View File

@ -18,7 +18,7 @@ const OLD_URL_WHITELIST: &[&str] =
/// Authorized versions in URLs pointing to the new specs.
const NEW_VERSION_WHITELIST: &[&str] = &[
"v1.1", "v1.2", "v1.3", "v1.4", "v1.5", "v1.6",
"v1.1", "v1.2", "v1.3", "v1.4", "v1.5", "v1.6", "v1.7",
"latest",
// This should only be enabled if a legitimate use case is found.
// "unstable",