summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2020-03-01 21:17:02 +0000
committerKornel <kornel@geekhood.net>2020-03-01 22:14:40 +0000
commit4060ea48873fdb5dfceae78b1cb1a6c5c0360e2b (patch)
treed9ac1977394b951fc20c50a796d3da56972fc51d
parent9ac4a8feb2e9aa8bb41f9125c6a6624a147c35f3 (diff)
Fetch user by ID hack doesn't work any more
-rw-r--r--github_info/src/lib_github.rs7
-rw-r--r--kitchen_sink/src/lib_kitchen_sink.rs15
2 files changed, 0 insertions, 22 deletions
diff --git a/github_info/src/lib_github.rs b/github_info/src/lib_github.rs
index 857a185..2b8e86a 100644
--- a/github_info/src/lib_github.rs
+++ b/github_info/src/lib_github.rs
@@ -102,13 +102,6 @@ impl GitHub {
.send(), id).await.map_err(|e| e.context("user_by_login"))
}
- pub async fn user_by_id(&self, user_id: u32) -> CResult<Option<User>> {
- let user_id = user_id.to_string();
- self.get_cached(&self.users, (&user_id, ""), |client| client.get()
- .path("users").arg(&user_id)
- .send(), id).await.map_err(|e| e.context("user_by_id"))
- }
-
pub async fn user_orgs(&self, login: &str) -> CResult<Option<Vec<UserOrg>>> {
let key = login.to_ascii_lowercase();
self.get_cached(&self.orgs, (&key, ""), |client| client.get()
diff --git a/kitchen_sink/src/lib_kitchen_sink.rs b/kitchen_sink/src/lib_kitchen_sink.rs
index 0998df3..0f95672 100644
--- a/kitchen_sink/src/lib_kitchen_sink.rs
+++ b/kitchen_sink/src/lib_kitchen_sink.rs
@@ -1806,21 +1806,6 @@ impl KitchenSink {
}
async fn owners_github(&self, owner: &CrateOwner) -> CResult<User> {
- // this is silly, but crates.io doesn't keep the github ID explicitly
- // (the id field is crates-io's field), but it does keep the avatar URL
- // which contains github's ID
- if let Some(ref avatar) = owner.avatar {
- lazy_static::lazy_static! {
- static ref R: regex::Regex = regex::Regex::new("https://avatars[0-9]+.githubusercontent.com/u/([0-9]+)").expect("regex");
- }
- if let Some(c) = R.captures(avatar) {
- let id = c.get(1).expect("regex").as_str();
- let id = id.parse().expect("regex");
- if let Some(user) = self.gh.user_by_id(id).await? {
- return Ok(user);
- }
- }
- }
// This is a bit weak, since logins are not permanent
if let Some(user) = self.gh.user_by_login(owner.github_login().ok_or(KitchenSinkErr::OwnerWithoutLogin)?).await? {
return Ok(user);