Replace -1 with GhostUserID (#27703)

This commit is contained in:
Nanguan Lin 2023-10-20 22:43:08 +08:00 committed by GitHub
parent eb1478791f
commit 881806a50b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 13 deletions

View file

@ -349,7 +349,7 @@ func (c *Comment) LoadPoster(ctx context.Context) (err error) {
c.Poster, err = user_model.GetPossibleUserByID(ctx, c.PosterID)
if err != nil {
if user_model.IsErrUserNotExist(err) {
c.PosterID = -1
c.PosterID = user_model.GhostUserID
c.Poster = user_model.NewGhostUser()
} else {
log.Error("getUserByID[%d]: %v", c.ID, err)