Selaa lähdekoodia

Add avatarUrl to remote model, send to graph for GitHub remotes

main
Ramin Tadayon 2 vuotta sitten
committed by Eric Amodio
vanhempi
commit
5d76f69f32
6 muutettua tiedostoa jossa 14 lisäystä ja 1 poistoa
  1. +1
    -0
      src/git/models/remote.ts
  2. +1
    -0
      src/git/parsers/remoteParser.ts
  3. +5
    -0
      src/git/remotes/github.ts
  4. +4
    -0
      src/git/remotes/provider.ts
  5. +2
    -0
      src/plus/github/githubGitProvider.ts
  6. +1
    -1
      src/webviews/apps/plus/graph/GraphWrapper.tsx

+ 1
- 0
src/git/models/remote.ts Näytä tiedosto

@ -56,6 +56,7 @@ export class GitRemote
public readonly path: string,
public readonly provider: TProvider,
public readonly urls: { type: GitRemoteType; url: string }[],
public readonly avatarUrl?: string | undefined,
) {}
get default() {

+ 1
- 0
src/git/parsers/remoteParser.ts Näytä tiedosto

@ -99,6 +99,7 @@ export class GitRemoteParser {
provider,
// Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
[{ url: url, type: ` ${type}`.substr(1) as GitRemoteType }],
provider !== undefined ? provider.avatarUrl : undefined,
);
remotes.push(remote);
groups[uniqueness] = remote;

+ 5
- 0
src/git/remotes/github.ts Näytä tiedosto

@ -101,6 +101,11 @@ export class GitHubRemote extends RichRemoteProvider {
return this.formatName('GitHub');
}
override get avatarUrl() {
const [owner] = this.splitPath();
return `https://avatars.githubusercontent.com/${owner}`;
}
@log()
override async connect(): Promise<boolean> {
if (!equalsIgnoreCase(this.domain, 'github.com')) {

+ 4
- 0
src/git/remotes/provider.ts Näytä tiedosto

@ -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;

+ 2
- 0
src/plus/github/githubGitProvider.ts Näytä tiedosto

@ -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,
),
];
}

+ 1
- 1
src/webviews/apps/plus/graph/GraphWrapper.tsx Näytä tiedosto

@ -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
};
});

Ladataan…
Peruuta
Tallenna