improve account lookup

This commit is contained in:
Ondřej Hruška 2021-08-27 00:43:06 +02:00
parent 674b9da6fa
commit 385d43c0aa
No known key found for this signature in database
GPG key ID: 2C5FD5035250423D
4 changed files with 11 additions and 11 deletions

View file

@ -1,5 +1,8 @@
# Changelog
## v0.2.4
- make account lookup try harder
## v0.2.3
- `/add user` will now try to follow even if already a member

2
Cargo.lock generated
View file

@ -328,7 +328,7 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]]
name = "fedigroups"
version = "0.2.3"
version = "0.2.4"
dependencies = [
"anyhow",
"clap",

View file

@ -1,6 +1,6 @@
[package]
name = "fedigroups"
version = "0.2.3"
version = "0.2.4"
authors = ["Ondřej Hruška <ondra@ondrovo.com>"]
edition = "2018"
publish = false

View file

@ -46,21 +46,18 @@ impl<'a> ProcessMention<'a> {
Err(e.into())
}
Ok(Ok(res)) => {
debug!("Result: {:#?}", res);
if let Some(item) = res.accounts.into_iter().next() {
for item in res.accounts {
let acct_normalized = normalize_acct(&item.acct, &self.group_acct)?;
if acct_normalized == acct {
debug!("Search done, account found: {}", item.acct);
Ok(Some(item.id))
return Ok(Some(item.id))
} else {
warn!("Search done but found wrong account: {}", item.acct);
Ok(None)
warn!("Found wrong account: {}", item.acct);
}
} else {
debug!("Search done, nothing found");
Ok(None)
}
debug!("Search done, nothing found");
Ok(None)
}
}
}