From 05f049e8bb1eabb8f9b2b967062524839f7e36aa Mon Sep 17 00:00:00 2001 From: bircni Date: Thu, 24 Sep 2026 21:01:34 +0200 Subject: [PATCH] fix(issues): don't render team review requests as Ghost (#39416) Closes https://github.com/go-gitea/gitea/issues/39414 `CommentList.loadAssignees` set a Ghost assignee on every comment without an `AssigneeID` whenever another comment in the same batch had one. Since https://github.com/go-gitea/gitea/pull/38413 the timeline prefers `Assignee` over `AssigneeTeam`, so team review requests, from CODEOWNERS or added manually, rendered as "Ghost" whenever the timeline also had a user assignee or user review request. Skip comments without an `AssigneeID`. Co-authored-by: silverwind --- models/issues/comment_list.go | 3 +++ models/issues/comment_test.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/models/issues/comment_list.go b/models/issues/comment_list.go index 495d48ff44b..24b28234d0e 100644 --- a/models/issues/comment_list.go +++ b/models/issues/comment_list.go @@ -201,6 +201,9 @@ func (comments CommentList) loadAssignees(ctx context.Context) error { } for _, comment := range comments { + if comment.AssigneeID <= 0 { + continue + } comment.Assignee = assignees[comment.AssigneeID] if comment.Assignee == nil { comment.AssigneeID = user_model.GhostUserID diff --git a/models/issues/comment_test.go b/models/issues/comment_test.go index 7b4dfed083f..1364cdbec63 100644 --- a/models/issues/comment_test.go +++ b/models/issues/comment_test.go @@ -58,6 +58,20 @@ func TestLoadAssigneeUserAndTeam_DeletedTeamBecomesGhostTeam(t *testing.T) { assert.EqualValues(t, -1, comment.AssigneeTeam.ID) } +func TestCommentListLoadAttributesMixedAssignees(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + comments := issues_model.CommentList{ + {AssigneeTeamID: 8}, + {AssigneeID: 999999}, + } + + assert.NoError(t, comments.LoadAttributes(t.Context())) + assert.Nil(t, comments[0].Assignee) + assert.Zero(t, comments[0].AssigneeID) + assert.Equal(t, user_model.GhostUserID, comments[1].AssigneeID) + assert.Equal(t, user_model.GhostUserID, comments[1].Assignee.ID) +} + func Test_UpdateCommentAttachment(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase())