mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
git_ui: Improve GitHub avatar display (#56755)
We had a problem that became more evident to me in the newly-introduced History tab in the Git panel where the avatars wouldn't show up for a long time. Problem was that we were trying to render the avatar before the GitHub user email came in, and that wouldn't work well because it would 1) skip the fast CDN (which could get rate-limited fast), and 2) cache the `None` result. So this improvement works by only attempting to render the avatar when the email is available. Release Notes: - Git UI: Improve the display of user avatars in Git-related surfaces.
This commit is contained in:
parent
58d24a610b
commit
e80b7443ea
1 changed files with 9 additions and 0 deletions
|
|
@ -96,6 +96,15 @@ impl<'a> CommitAvatar<'a> {
|
|||
}
|
||||
|
||||
pub fn avatar(&'a self, window: &mut Window, cx: &mut App) -> Option<Avatar> {
|
||||
// Bail early if the email isn't available yet. Without it,
|
||||
// the GitHub provider skips the fast CDN path and falls back
|
||||
// to an unauthenticated per-commit API call that is slow and
|
||||
// rate-limited. Worse, a failed lookup gets permanently
|
||||
// cached under the key (sha, host) — so even when the email
|
||||
// arrives on a later render, the cached None shadows the
|
||||
// fast path forever.
|
||||
self.author_email.as_ref()?;
|
||||
|
||||
let remote = self
|
||||
.remote
|
||||
.filter(|remote| remote.host_supports_avatars())?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue