|
1 | 1 | import { EventEmitter, Uri } from 'vscode'; |
2 | 2 | import type { CommitAuthor } from '@gitlens/git/models/author.js'; |
| 3 | +import { CustomRemoteProvider } from '@gitlens/git/remotes/custom.js'; |
3 | 4 | import { getGitHubNoReplyAddressParts } from '@gitlens/git/remotes/github.js'; |
4 | 5 | import { base64 } from '@gitlens/utils/base64.js'; |
5 | 6 | import { md5 } from '@gitlens/utils/crypto.js'; |
@@ -135,7 +136,7 @@ function getAvatarUriCore( |
135 | 136 | if ( |
136 | 137 | !options?.cached && |
137 | 138 | repoPathOrCommit != null && |
138 | | - getContext('gitlens:repos:withHostingIntegrationsConnected')?.includes( |
| 139 | + getContext('gitlens:repos:withRemotes')?.includes( |
139 | 140 | typeof repoPathOrCommit === 'string' ? repoPathOrCommit : repoPathOrCommit.repoPath, |
140 | 141 | ) |
141 | 142 | ) { |
@@ -245,6 +246,23 @@ async function getAvatarUriFromRemoteProvider( |
245 | 246 | avatarSize: size, |
246 | 247 | }); |
247 | 248 | } |
| 249 | + |
| 250 | + if (!account) { |
| 251 | + const remoteWithProvider = await Container.instance.git |
| 252 | + .getRepositoryService(repoPathOrCommit.repoPath) |
| 253 | + .remotes.getBestRemoteWithProvider(); |
| 254 | + |
| 255 | + if (remoteWithProvider?.provider instanceof CustomRemoteProvider) { |
| 256 | + const avatarUrl = remoteWithProvider.provider.getUrlForAvatar(email, size); |
| 257 | + if (avatarUrl != null) { |
| 258 | + avatar.uri = Uri.parse(avatarUrl); |
| 259 | + avatar.timestamp = Date.now(); |
| 260 | + avatar.retries = 0; |
| 261 | + avatarCache.set(`${md5(email.trim().toLowerCase())}:${size}`, { ...avatar }); |
| 262 | + return avatar.uri; |
| 263 | + } |
| 264 | + } |
| 265 | + } |
248 | 266 | } |
249 | 267 |
|
250 | 268 | if (account?.avatarUrl == null) { |
|
0 commit comments