From 5d76f69f322f63c5689121a0c1f41d33ae7b845b Mon Sep 17 00:00:00 2001 From: Ramin Tadayon Date: Wed, 17 Aug 2022 11:50:52 +0900 Subject: [PATCH] Add avatarUrl to remote model, send to graph for GitHub remotes --- src/git/models/remote.ts | 1 + src/git/parsers/remoteParser.ts | 1 + src/git/remotes/github.ts | 5 +++++ src/git/remotes/provider.ts | 4 ++++ src/plus/github/githubGitProvider.ts | 2 ++ src/webviews/apps/plus/graph/GraphWrapper.tsx | 2 +- 6 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/git/models/remote.ts b/src/git/models/remote.ts index a037e0c..6f5ffa9 100644 --- a/src/git/models/remote.ts +++ b/src/git/models/remote.ts @@ -56,6 +56,7 @@ export class GitRemote { if (!equalsIgnoreCase(this.domain, 'github.com')) { diff --git a/src/git/remotes/provider.ts b/src/git/remotes/provider.ts index 024c31b..2f0994e 100644 --- a/src/git/remotes/provider.ts +++ b/src/git/remotes/provider.ts @@ -129,6 +129,10 @@ export abstract class RemoteProvider implements RemoteProviderReference { return 'remote'; } + get avatarUrl(): string | undefined { + return undefined; + } + abstract get id(): string; abstract get name(): string; diff --git a/src/plus/github/githubGitProvider.ts b/src/plus/github/githubGitProvider.ts index 11a7c51..ecc6735 100644 --- a/src/plus/github/githubGitProvider.ts +++ b/src/plus/github/githubGitProvider.ts @@ -2145,6 +2145,7 @@ export class GitHubGitProvider implements GitProvider, Disposable { const url = `https://github.com/${owner}/${repo}.git`; const domain = 'github.com'; const path = `${owner}/${repo}`; + const avatarUrl = `https://avatars.githubusercontent.com/${owner}`; return [ new GitRemote( @@ -2159,6 +2160,7 @@ export class GitHubGitProvider implements GitProvider, Disposable { { type: GitRemoteType.Fetch, url: url }, { type: GitRemoteType.Push, url: url }, ], + avatarUrl, ), ]; } diff --git a/src/webviews/apps/plus/graph/GraphWrapper.tsx b/src/webviews/apps/plus/graph/GraphWrapper.tsx index 2ec6e1f..5436c54 100644 --- a/src/webviews/apps/plus/graph/GraphWrapper.tsx +++ b/src/webviews/apps/plus/graph/GraphWrapper.tsx @@ -95,7 +95,7 @@ const getGraphModel = ( matchingRemote !== undefined ? branch.name.replace(`${matchingRemote.name}/`, '') : branch.name, url: matchingRemoteUrl, // TODO: Add avatarUrl support for remotes - // avatarUrl: matchingRemote?.avatarUrl ?? undefined + avatarUrl: matchingRemote?.avatarUrl ?? undefined }; });