Simplify feature condition.

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
dasha_uwu
2025-08-11 09:59:15 +00:00
committed by Jason Volk
parent a3666fe672
commit 6a6f77a100

View File

@@ -125,27 +125,17 @@ pub async fn try_auth(
match auth {
// Find out what the user completed
| AuthData::Password(Password {
identifier,
password,
#[cfg(feature = "element_hacks")]
user,
..
}) => {
#[cfg(feature = "element_hacks")]
| AuthData::Password(Password { identifier, password, user, .. }) => {
let username = if let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier {
username
} else if let Some(username) = user {
} else if cfg!(feature = "element_hacks")
&& let Some(username) = user
{
username
} else {
return Err!(Request(Unrecognized("Identifier type not recognized.")));
};
#[cfg(not(feature = "element_hacks"))]
let Some(UserIdentifier::UserIdOrLocalpart(username)) = identifier else {
return Err!(Request(Unrecognized("Identifier type not recognized.")));
};
let user_id_from_username = UserId::parse_with_server_name(
username.clone(),
self.services.globals.server_name(),