Browse Source

Changes avatarUrl to avatarUri on RemoteProvider

Removes avatarUrl from GitRemote (as it duplicates RemoteProvider)
main
Eric Amodio 2 years ago
parent
commit
f20c1dc58b
5 changed files with 11 additions and 15 deletions
  1. +0
    -1
      src/git/models/remote.ts
  2. +0
    -1
      src/git/parsers/remoteParser.ts
  3. +7
    -7
      src/git/remotes/github.ts
  4. +4
    -4
      src/git/remotes/provider.ts
  5. +0
    -2
      src/plus/github/githubGitProvider.ts

+ 0
- 1
src/git/models/remote.ts View File

@ -56,7 +56,6 @@ 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() {

+ 0
- 1
src/git/parsers/remoteParser.ts View File

@ -99,7 +99,6 @@ 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;

+ 7
- 7
src/git/remotes/github.ts View File

@ -1,5 +1,5 @@
import type { AuthenticationSession, Range, Uri } from 'vscode';
import { window } from 'vscode';
import type { AuthenticationSession, Range } from 'vscode';
import { Uri, window } from 'vscode';
import type { Autolink, DynamicAutolinkReference } from '../../annotations/autolinks';
import type { AutolinkReference } from '../../config';
import { Container } from '../../container';
@ -89,6 +89,11 @@ export class GitHubRemote extends RichRemoteProvider {
return this._autolinks;
}
override get avatarUri() {
const [owner] = this.splitPath();
return Uri.parse(`https://avatars.githubusercontent.com/${owner}`);
}
override get icon() {
return 'github';
}
@ -101,11 +106,6 @@ 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
- 4
src/git/remotes/provider.ts View File

@ -121,6 +121,10 @@ export abstract class RemoteProvider implements RemoteProviderReference {
return [];
}
get avatarUri(): Uri | undefined {
return undefined;
}
get displayPath(): string {
return this.path;
}
@ -129,10 +133,6 @@ export abstract class RemoteProvider implements RemoteProviderReference {
return 'remote';
}
get avatarUrl(): string | undefined {
return undefined;
}
abstract get id(): string;
abstract get name(): string;

+ 0
- 2
src/plus/github/githubGitProvider.ts View File

@ -2145,7 +2145,6 @@ 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(
@ -2160,7 +2159,6 @@ export class GitHubGitProvider implements GitProvider, Disposable {
{ type: GitRemoteType.Fetch, url: url },
{ type: GitRemoteType.Push, url: url },
],
avatarUrl,
),
];
}

Loading…
Cancel
Save