Skip to content

Commit e047fa6

Browse files
BagToadCopilot
andcommitted
Address review comments: use actorDisplayName for Copilot author display
- Add actorDisplayName call in CommentAuthor.DisplayName for consistency - Use require.Equal in TestActorDisplayName instead of manual comparisons - Simplify user type name constant usage Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3651c28 commit e047fa6

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

api/queries_pr_review.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ type RequestedReviewer struct {
143143

144144
const teamTypeName = "Team"
145145
const botTypeName = "Bot"
146+
const userTypeName = "User"
146147

147148
func (r RequestedReviewer) LoginOrSlug() string {
148149
if r.TypeName == teamTypeName {

api/queries_repo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ func NewAssignableUser(id, login, name string) AssignableUser {
11351135

11361136
// DisplayName returns a user-friendly name via actorDisplayName.
11371137
func (u AssignableUser) DisplayName() string {
1138-
return actorDisplayName("User", u.login, u.name)
1138+
return actorDisplayName(userTypeName, u.login, u.name)
11391139
}
11401140

11411141
func (u AssignableUser) ID() string {
@@ -1165,7 +1165,7 @@ func NewAssignableBot(id, login string) AssignableBot {
11651165
}
11661166

11671167
func (b AssignableBot) DisplayName() string {
1168-
return actorDisplayName("Bot", b.login, "")
1168+
return actorDisplayName(botTypeName, b.login, "")
11691169
}
11701170

11711171
func (b AssignableBot) ID() string {

api/queries_repo_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,7 @@ func TestActorDisplayName(t *testing.T) {
583583
}
584584
for _, tt := range tests {
585585
t.Run(tt.name, func(t *testing.T) {
586-
got := actorDisplayName(tt.typeName, tt.login, tt.actName)
587-
if got != tt.want {
588-
t.Errorf("actorDisplayName(%q, %q, %q) = %q, want %q", tt.typeName, tt.login, tt.actName, got, tt.want)
589-
}
586+
require.Equal(t, tt.want, actorDisplayName(tt.typeName, tt.login, tt.actName))
590587
})
591588
}
592589
}

0 commit comments

Comments
 (0)