Skip to content

Commit 743e151

Browse files
Copilotalexr00
andcommitted
Address code review feedback: remove unnecessary constant, use GitHub codicon instead of fallback, remove tests
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 27eb60a commit 743e151

3 files changed

Lines changed: 21 additions & 42 deletions

File tree

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
"githubIssues.assignWhenWorking.description": "Assigns the issue you're working on to you. Only applies when the issue you're working on is in a repo you currently have open.",
152152
"githubIssues.issueAvatarDisplay.description": "Controls which avatar to display in the issue list.",
153153
"githubIssues.issueAvatarDisplay.author": "Show the avatar of the issue creator",
154-
"githubIssues.issueAvatarDisplay.assignee": "Show the avatar of the first assignee (fallback to creator if no assignees)",
154+
"githubIssues.issueAvatarDisplay.assignee": "Show the avatar of the first assignee (show GitHub icon if no assignees)",
155155
"githubPullRequests.focusedMode.description": "The layout to use when a pull request is checked out. Set to false to prevent layout changes.",
156156
"githubPullRequests.focusedMode.firstDiff": "Show the first diff in the pull request. If there are no changes, show the overview.",
157157
"githubPullRequests.focusedMode.overview": "Show the overview of the pull request.",

src/issues/issuesView.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ export class IssuesTreeData
3939
FolderRepositoryManager | IssueItem | null | undefined | void
4040
> = this._onDidChangeTreeData.event;
4141

42-
// Store the configuration key as a constant to avoid repeated string concatenation
43-
private static readonly AVATAR_SETTING_KEY = `${ISSUES_SETTINGS_NAMESPACE}.${ISSUE_AVATAR_DISPLAY}`;
44-
4542
constructor(
4643
private stateManager: StateManager,
4744
private manager: RepositoriesManager,
@@ -67,7 +64,7 @@ export class IssuesTreeData
6764
// Listen for changes to the avatar display setting
6865
context.subscriptions.push(
6966
vscode.workspace.onDidChangeConfiguration(change => {
70-
if (change.affectsConfiguration(IssuesTreeData.AVATAR_SETTING_KEY)) {
67+
if (change.affectsConfiguration(`${ISSUES_SETTINGS_NAMESPACE}.${ISSUE_AVATAR_DISPLAY}`)) {
7168
this._onDidChangeTreeData.fire();
7269
}
7370
}),
@@ -96,17 +93,27 @@ export class IssuesTreeData
9693
.getConfiguration(ISSUES_SETTINGS_NAMESPACE, null)
9794
.get<string>(ISSUE_AVATAR_DISPLAY, 'author');
9895

99-
// Determine which user to use for the avatar
100-
let avatarUser = element.author;
101-
if (avatarDisplaySetting === 'assignee' && element.assignees && element.assignees.length > 0) {
102-
// Use the first assignee if available
103-
avatarUser = element.assignees[0];
96+
// Determine which user to use for the avatar or if we should use a codicon
97+
let avatarUser: typeof element.author | undefined = element.author;
98+
if (avatarDisplaySetting === 'assignee') {
99+
if (element.assignees && element.assignees.length > 0) {
100+
// Use the first assignee if available
101+
avatarUser = element.assignees[0];
102+
} else {
103+
// No assignees, don't use an avatar
104+
avatarUser = undefined;
105+
}
104106
}
105107

106-
treeItem.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this.context, [avatarUser], 16, 16))[0] ??
107-
(element.isOpen
108-
? new vscode.ThemeIcon('issues', new vscode.ThemeColor('issues.open'))
109-
: new vscode.ThemeIcon('issue-closed', new vscode.ThemeColor('issues.closed')));
108+
if (avatarUser) {
109+
treeItem.iconPath = (await DataUri.avatarCirclesAsImageDataUris(this.context, [avatarUser], 16, 16))[0] ??
110+
(element.isOpen
111+
? new vscode.ThemeIcon('issues', new vscode.ThemeColor('issues.open'))
112+
: new vscode.ThemeIcon('issue-closed', new vscode.ThemeColor('issues.closed')));
113+
} else {
114+
// Use GitHub codicon when assignee setting is selected but no assignees exist
115+
treeItem.iconPath = new vscode.ThemeIcon('github');
116+
}
110117

111118
treeItem.command = {
112119
command: 'issue.openDescription',

src/test/issues/issuesView.test.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)