Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/issues/issuesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,15 @@ export class IssuesTreeData
}

if (avatarUser) {
treeItem.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this.context, [avatarUser], 16, 16))[0] ??
(element.isOpen
? new vscode.ThemeIcon('issues', new vscode.ThemeColor('issues.open'))
: new vscode.ThemeIcon('issue-closed', new vscode.ThemeColor('github.issues.closed')));
// For enterprise, use placeholder icon instead of trying to fetch avatar
if (element.githubRepository.remote.isEnterprise) {
treeItem.iconPath = new vscode.ThemeIcon('github');
} else {
treeItem.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this.context, [avatarUser], 16, 16))[0] ??
(element.isOpen
? new vscode.ThemeIcon('issues', new vscode.ThemeColor('issues.open'))
: new vscode.ThemeIcon('issue-closed', new vscode.ThemeColor('github.issues.closed')));
}
} else {
// Use GitHub codicon when assignee setting is selected but no assignees exist
treeItem.iconPath = new vscode.ThemeIcon('github');
Expand Down
11 changes: 8 additions & 3 deletions src/view/treeNodes/commitNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { LabelOnlyNode, TreeNode, TreeNodeParent } from './treeNode';
export class CommitNode extends TreeNode implements vscode.TreeItem {
public sha: string;
public collapsibleState: vscode.TreeItemCollapsibleState;
public iconPath: vscode.Uri | undefined;
public iconPath: vscode.Uri | vscode.ThemeIcon | undefined;
public contextValue?: string;

constructor(
Expand All @@ -40,8 +40,13 @@ export class CommitNode extends TreeNode implements vscode.TreeItem {

async getTreeItem(): Promise<vscode.TreeItem> {
if (this.commit.author) {
const author: IAccount = { id: this.commit.author.node_id, login: this.commit.author.login, url: this.commit.author.url, avatarUrl: this.commit.author.avatar_url, accountType: this.commit.author.type as AccountType };
this.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this.pullRequestManager.context, [author], 16, 16))[0];
// For enterprise, use placeholder icon instead of trying to fetch avatar
if (this.pullRequest.githubRepository.remote.isEnterprise) {
this.iconPath = new vscode.ThemeIcon('github');
} else {
const author: IAccount = { id: this.commit.author.node_id, login: this.commit.author.login, url: this.commit.author.url, avatarUrl: this.commit.author.avatar_url, accountType: this.commit.author.type as AccountType };
this.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this.pullRequestManager.context, [author], 16, 16))[0];
}
}
return this;
}
Expand Down
15 changes: 11 additions & 4 deletions src/view/treeNodes/pullRequestNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,20 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
});
}

private async _getAuthorIcon(): Promise<vscode.Uri | vscode.ThemeIcon> {
// For enterprise, use placeholder icon instead of trying to fetch avatar
if (this.pullRequestModel.githubRepository.remote.isEnterprise) {
return new vscode.ThemeIcon('github');
}
return (await DataUri.avatarCirclesAsImageDataUris(this._folderReposManager.context, [this.pullRequestModel.author], 16, 16))[0]
?? new vscode.ThemeIcon('github');
}

private async _getIcon(): Promise<vscode.Uri | vscode.ThemeIcon | { light: vscode.Uri; dark: vscode.Uri }> {
const copilotWorkingStatus = await this.pullRequestModel.copilotWorkingStatus();
const theme = this._folderReposManager.themeWatcher.themeData;
if (copilotWorkingStatus === CopilotWorkingStatus.NotCopilotIssue) {
return (await DataUri.avatarCirclesAsImageDataUris(this._folderReposManager.context, [this.pullRequestModel.author], 16, 16))[0]
?? new vscode.ThemeIcon('github');
return this._getAuthorIcon();
}
switch (copilotWorkingStatus) {
case CopilotWorkingStatus.InProgress:
Expand All @@ -294,8 +302,7 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2
dark: DataUri.copilotErrorAsImageDataURI(getIconForeground(theme, 'dark'), getListErrorForeground(theme, 'dark'))
};
default:
return (await DataUri.avatarCirclesAsImageDataUris(this._folderReposManager.context, [this.pullRequestModel.author], 16, 16))[0]
?? new vscode.ThemeIcon('github');
return this._getAuthorIcon();
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/view/treeNodes/repositoryChangesNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ export class RepositoryChangesNode extends TreeNode implements vscode.TreeItem {

override async getTreeItem(): Promise<vscode.TreeItem> {
this.setLabel();
this.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this._pullRequestManager.context, [this.pullRequestModel.author], 16, 16))[0];
// For enterprise, use placeholder icon instead of trying to fetch avatar
if (this.pullRequestModel.githubRepository.remote.isEnterprise) {
this.iconPath = new vscode.ThemeIcon('github');
} else {
this.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this._pullRequestManager.context, [this.pullRequestModel.author], 16, 16))[0];
}
this.description = undefined;
if (this.parent.children?.length && this.parent.children.length > 1) {
const allSameOwner = this.parent.children.every(child => {
Expand Down