Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get avatars from GitHub if possible #281

Open
monk-time opened this issue Feb 9, 2018 · 9 comments

Comments

@monk-time
Copy link

commented Feb 9, 2018

Since I haven't registered my e-mail on gravatar, Git Lens shows all my commits with a default avatar. I think it would be neat if it could try to fetch an avatar from GitHub if a user has GitHub remotes under their user.name on GitHub or user.email=*@users.noreply.github.com in Git's config. Or maybe just send a request to https://api.github.com/users/{user.name} in all cases?

  • GitLens Version: 8.0.0
  • VSCode Version: 1.20
  • OS Version: Win7x64
@eamodio

This comment has been minimized.

Copy link
Owner

commented Feb 9, 2018

Honestly, I looked into adding this when I add the avatars feature, but shied away from it because I only have the email address of the commit author and there isn't a any (that I know of) to get a GitHub username from an email (unless as you say the e-mail address is *@users.noreply.github.com -- which I honestly haven't seen in the wild). I had thought about fuzzy lookup, but because there is a chance they can return the wrong data (an email, without the domain, could match someone else's GitHub account), I'm don't think it is a good solution.

Also need to consider that these avatars aren't just for the local user, they are anyone who has committed to the repository, so it would need to work for them all.

@monk-time

This comment has been minimized.

Copy link
Author

commented Feb 9, 2018

Yeah, I haven't considered all that.

Another idea: what about going through remotes? The extension can show GH avatars only if a repo has at least one GitHub remote configured. Then it can do a one-time request to GH to see if there are matching hashes between remote and local repos, and create an e-mail:GH-user:avatar mapping based on that. There must be some API incantation to search for a hash in a repo and get an author's avatar for a matching commit. Once it's done, this mapping can be used to show avatars for new commits.

@eamodio

This comment has been minimized.

Copy link
Owner

commented Feb 9, 2018

Sounds like a lot of upfront processing work, that is very GitHub specific. I normally try to stay away from features that will only work with 1 provider/host, since I want GitLens to have a broader reach and no favorites 😄

Given the challenges here and the value of the feature imo -- it isn't worth the investment (for me). But if the community wants to submit a PR (start with a spec first please) I'm open.

@Chudesnov

This comment has been minimized.

Copy link

commented Oct 5, 2018

There is a method to search GitHub users by email or full name, so if we design a generic avatar service (as DonJayamanne/gitHistoryVSCode#220 does, for instance) and current Gravatar URI generator as its implementation, there's a way to provide such services for GitHub, GitLab users, etc.

@eamodio

This comment has been minimized.

Copy link
Owner

commented Oct 5, 2018

I'd be thrilled to review/accept a PR for something like this 😄

@tecosaur

This comment has been minimized.

Copy link

commented Mar 12, 2019

@eamodio Just regarding getting avatars for no-reply emails such as 20903656+tecosaur@users.noreply.github.com would you be willing to point me to the relevant bits of the codebase and I'll take a look and implement it if it isn't too hard.

@tecosaur

This comment has been minimized.

Copy link

commented Aug 18, 2019

This may be of interest: mhutchie/vscode-git-graph@ee829d6

eamodio added a commit that referenced this issue Aug 20, 2019
Partial fix for #281- covers the `*@users.noreply.github.com` case.

The `users.noreply.github.com` domain comes from users
making use GitHub's 'email privacy' feature.
Since the noreply address doesn't accept email, a user can't link
their preferred Gravatar to this type of email address.

The upside is that this address is easily parsable into:
* (optional) Github User ID
* Github User Name

We can use either to create the associated avatar link
without actually having to do an additonal request
against Github's user search API.
@KamasamaK

This comment has been minimized.

Copy link

commented Sep 20, 2019

For some reason, gravatars are HUGE in the line blame hover.

@eamodio

This comment has been minimized.

Copy link
Owner

commented Sep 20, 2019

@KamasamaK can you please open a new issue for this? And I can't seem to reproduce it, so please provide any details you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.