diff --git a/src/issues/issuesView.ts b/src/issues/issuesView.ts index 9d172d9c05..cec1c09b07 100644 --- a/src/issues/issuesView.ts +++ b/src/issues/issuesView.ts @@ -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'); diff --git a/src/view/treeNodes/commitNode.ts b/src/view/treeNodes/commitNode.ts index 6c4a4e202e..616519c361 100644 --- a/src/view/treeNodes/commitNode.ts +++ b/src/view/treeNodes/commitNode.ts @@ -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( @@ -40,8 +40,13 @@ export class CommitNode extends TreeNode implements vscode.TreeItem { async getTreeItem(): Promise { 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; } diff --git a/src/view/treeNodes/pullRequestNode.ts b/src/view/treeNodes/pullRequestNode.ts index 58176edf8b..f3a2a2440b 100644 --- a/src/view/treeNodes/pullRequestNode.ts +++ b/src/view/treeNodes/pullRequestNode.ts @@ -270,12 +270,20 @@ export class PRNode extends TreeNode implements vscode.CommentingRangeProvider2 }); } + private async _getAuthorIcon(): Promise { + // 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 { 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: @@ -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(); } } diff --git a/src/view/treeNodes/repositoryChangesNode.ts b/src/view/treeNodes/repositoryChangesNode.ts index 1baaeff188..efc0acb51e 100644 --- a/src/view/treeNodes/repositoryChangesNode.ts +++ b/src/view/treeNodes/repositoryChangesNode.ts @@ -111,7 +111,12 @@ export class RepositoryChangesNode extends TreeNode implements vscode.TreeItem { override async getTreeItem(): Promise { 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 => {