Make GetPossibleUserByID can handle deleted user (#37430) (#37431)

Backport #37430
This commit is contained in:
wxiaoguang authored and GitHub committed 2026-04-27 00:33:09 +08:00
1 parent 2a61284ba5
commit cff6eb5661
10 files changed
+34 -71

No files matched your search

+2 -6
View File
@@ -104,13 +104,9 @@ func getReleaseInfos(ctx *context.Context, opts *repo_model.FindReleasesOptions)
releaseInfos := make([]*ReleaseInfo, 0, len(releases))
for _, r := range releases {
if r.Publisher, ok = cacheUsers[r.PublisherID]; !ok {
r.Publisher, err = user_model.GetPossibleUserByID(ctx, r.PublisherID)
r.PublisherID, r.Publisher, err = user_model.GetPossibleUserByID(ctx, r.PublisherID)
if err != nil {
if user_model.IsErrUserNotExist(err) {
r.Publisher = user_model.NewGhostUser()
} else {
return nil, err
}
return nil, err
}
cacheUsers[r.PublisherID] = r.Publisher
}