mirror of
https://git.ondrovo.com/MightyPork/group-actor.git
synced 2024-11-25 01:21:02 +00:00
add server lowercasing also to group_config::acct_to_server()
This commit is contained in:
parent
cbd3c0a575
commit
cb6724baab
1 changed files with 6 additions and 6 deletions
|
@ -458,7 +458,7 @@ impl GroupConfig {
|
||||||
/// Check if the user's server is banned
|
/// Check if the user's server is banned
|
||||||
fn is_users_server_banned(&self, acct: &str) -> bool {
|
fn is_users_server_banned(&self, acct: &str) -> bool {
|
||||||
let server = acct_to_server(acct);
|
let server = acct_to_server(acct);
|
||||||
self.is_server_banned(server)
|
self.is_server_banned(&server)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn can_write(&self, acct: &str) -> bool {
|
pub(crate) fn can_write(&self, acct: &str) -> bool {
|
||||||
|
@ -574,8 +574,8 @@ impl GroupConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn acct_to_server(acct: &str) -> &str {
|
fn acct_to_server(acct: &str) -> String {
|
||||||
acct.split('@').nth(1).unwrap_or_default()
|
crate::utils::acct_to_server(acct).unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
@ -594,9 +594,9 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_acct_to_server() {
|
fn test_acct_to_server() {
|
||||||
assert_eq!("pikachu.rocks", acct_to_server("raichu@pikachu.rocks"));
|
assert_eq!("pikachu.rocks".to_string(), acct_to_server("raichu@pikachu.rocks"));
|
||||||
assert_eq!("pikachu.rocks", acct_to_server("m@pikachu.rocks"));
|
assert_eq!("pikachu.rocks".to_string(), acct_to_server("m@pikachu.rocks"));
|
||||||
assert_eq!("", acct_to_server("what"));
|
assert_eq!("".to_string(), acct_to_server("what"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue