1
0
Fork 0

Use ghost user if user was not found (#29161)

Fixes #29159

(cherry picked from commit 37061e8266806c0b2b66ac64138e725632b295db)
This commit is contained in:
KN4CK3R 2024-02-14 17:31:51 +01:00 committed by Earl Warren
parent e52d877582
commit 6eaabb1a9d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 12 additions and 0 deletions

View file

@ -225,6 +225,10 @@ func (comments CommentList) loadAssignees(ctx context.Context) error {
for _, comment := range comments { for _, comment := range comments {
comment.Assignee = assignees[comment.AssigneeID] comment.Assignee = assignees[comment.AssigneeID]
if comment.Assignee == nil {
comment.AssigneeID = user_model.GhostUserID
comment.Assignee = user_model.NewGhostUser()
}
} }
return nil return nil
} }

View file

@ -159,6 +159,14 @@ func (r *Review) LoadReviewer(ctx context.Context) (err error) {
return err return err
} }
r.Reviewer, err = user_model.GetPossibleUserByID(ctx, r.ReviewerID) r.Reviewer, err = user_model.GetPossibleUserByID(ctx, r.ReviewerID)
if err != nil {
if !user_model.IsErrUserNotExist(err) {
return fmt.Errorf("GetPossibleUserByID [%d]: %w", r.ReviewerID, err)
}
r.ReviewerID = user_model.GhostUserID
r.Reviewer = user_model.NewGhostUser()
return nil
}
return err return err
} }