Make GetPossibleUserByID can handle deleted user (#37430)

Make sure deleted user won't cause 500 error, simplify the caller's code
This commit is contained in:
wxiaoguang
2026-04-27 00:57:53 +08:00
committed by GitHub
parent 2f42c8cf72
commit 068b59aa97
11 changed files with 36 additions and 74 deletions

View File

@@ -831,7 +831,7 @@ func ToOAuth2Application(app *auth.OAuth2Application) *api.OAuth2Application {
// ToLFSLock convert a LFSLock to api.LFSLock
func ToLFSLock(ctx context.Context, l *git_model.LFSLock) *api.LFSLock {
u, err := user_model.GetPossibleUserByID(ctx, l.OwnerID)
_, u, err := user_model.GetPossibleUserByID(ctx, l.OwnerID)
if err != nil {
return nil
}