mirror of
https://git.ondrovo.com/MightyPork/group-actor.git
synced 2024-11-21 15:41:03 +00:00
Normalize server from group actor too
as specified in tests
This commit is contained in:
parent
900f499932
commit
e1ac2777f3
1 changed files with 4 additions and 4 deletions
|
@ -19,8 +19,8 @@ impl<V, E: Error> LogError for Result<V, E> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn acct_to_server(acct: &str) -> Option<&str> {
|
pub(crate) fn acct_to_server(acct: &str) -> Option<String> {
|
||||||
acct.trim_start_matches('@').split('@').nth(1)
|
acct.trim_start_matches('@').split('@').nth(1).map(|s| s.to_lowercase())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn normalize_acct(acct: &str, group: &str) -> Result<String, GroupError> {
|
pub(crate) fn normalize_acct(acct: &str, group: &str) -> Result<String, GroupError> {
|
||||||
|
@ -45,8 +45,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_acct_to_server() {
|
fn test_acct_to_server() {
|
||||||
assert_eq!(Some("novak"), acct_to_server("pepa@novak"));
|
assert_eq!(Some("novak".to_string()), acct_to_server("pepa@novak"));
|
||||||
assert_eq!(Some("banana.co.uk"), acct_to_server("@pepa@banana.co.uk"));
|
assert_eq!(Some("banana.co.uk".to_string()), acct_to_server("@pepa@banana.co.uk"));
|
||||||
assert_eq!(None, acct_to_server("probably_local"));
|
assert_eq!(None, acct_to_server("probably_local"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue