Skip to content

Commit

Permalink
Always show usernames in reaction tooltips (#26444)
Browse files Browse the repository at this point in the history
Even if GetDisplayName() is normally preferred elsewhere, this change
provides more consistency, as usernames are also always being shown
when participating in a conversation taking place in an issue or
a pull request. This change makes conversations easier to follow, as
you would not have to have a mental association between someone's
username and someone's real name in order to follow what is happening.

This behavior matches GitHub's. Optimally, both the username and the
full name (if applicable) could be shown, but such an effort is a
much bigger task that needs to be thought out well.
  • Loading branch information
n0toose authored Aug 10, 2023
1 parent 7a69d71 commit 2cbd377
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion models/issues/reaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (list ReactionList) GetFirstUsers() string {
if buffer.Len() > 0 {
buffer.WriteString(", ")
}
buffer.WriteString(reaction.User.DisplayName())
buffer.WriteString(reaction.User.Name)
if rem--; rem == 0 {
break
}
Expand Down
2 changes: 1 addition & 1 deletion models/issues/reaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestIssueReactionCount(t *testing.T) {
reactions := reactionsList.GroupByType()
assert.Len(t, reactions["heart"], 4)
assert.Equal(t, 2, reactions["heart"].GetMoreUserCount())
assert.Equal(t, user1.DisplayName()+", "+user2.DisplayName(), reactions["heart"].GetFirstUsers())
assert.Equal(t, user1.Name+", "+user2.Name, reactions["heart"].GetFirstUsers())
assert.True(t, reactions["heart"].HasUser(1))
assert.False(t, reactions["heart"].HasUser(5))
assert.False(t, reactions["heart"].HasUser(0))
Expand Down

0 comments on commit 2cbd377

Please sign in to comment.