mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
style: Combine "unsupported version" checks
This commit is contained in:
@@ -279,15 +279,12 @@ pub(crate) async fn upgrade_room_route(
|
||||
) -> Result<upgrade_room::v3::Response> {
|
||||
let sender_user = body.sender_user();
|
||||
|
||||
if !services.server.supported_room_version(&body.new_version) {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::UnsupportedRoomVersion,
|
||||
"This server does not support that room version.",
|
||||
));
|
||||
}
|
||||
if !services.config.allow_unstable_room_versions
|
||||
&& UNSTABLE_ROOM_VERSIONS.contains(&body.new_version)
|
||||
{
|
||||
let (supported, forbid_unstable, is_unstable) = (
|
||||
services.server.supported_room_version(&body.new_version),
|
||||
!services.config.allow_unstable_room_versions,
|
||||
UNSTABLE_ROOM_VERSIONS.contains(&body.new_version),
|
||||
);
|
||||
if !supported || (forbid_unstable && is_unstable) {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::UnsupportedRoomVersion,
|
||||
"This server does not support that room version.",
|
||||
|
||||
Reference in New Issue
Block a user