Merge pull request #18 from LefsFlarey/issue/3675

Fix 500 error caused by deleted users on issues (#3675)
pull/46/merge
Lunny Xiao 8 years ago committed by GitHub
commit c511f1c6c3
  1. 8
      models/issue.go

@ -94,12 +94,12 @@ func (issue *Issue) loadAttributes(e Engine) (err error) {
if issue.Poster == nil { if issue.Poster == nil {
issue.Poster, err = getUserByID(e, issue.PosterID) issue.Poster, err = getUserByID(e, issue.PosterID)
if err != nil { if err != nil {
if IsErrUserNotExist(err) { issue.PosterID = -1
issue.PosterID = -1 issue.Poster = NewGhostUser()
issue.Poster = NewGhostUser() if !IsErrUserNotExist(err) {
} else {
return fmt.Errorf("getUserByID.(poster) [%d]: %v", issue.PosterID, err) return fmt.Errorf("getUserByID.(poster) [%d]: %v", issue.PosterID, err)
} }
err = nil
return return
} }
} }

Loading…
Cancel
Save