Merge pull request #2599 from mhartkorn/fix-release-error-deleted-user

Fix for server error on release page when a user deleted their account
This commit is contained in:
Unknwon 2016-02-10 16:11:56 -05:00
commit 0ad5f51059

View file

@ -45,9 +45,13 @@ func Releases(ctx *middleware.Context) {
if rel.TagName == rawTag {
rel.Publisher, err = models.GetUserByID(rel.PublisherID)
if err != nil {
if models.IsErrUserNotExist(err) {
rel.Publisher = models.NewFakeUser()
} else {
ctx.Handle(500, "GetUserByID", err)
return
}
}
// FIXME: duplicated code.
// Get corresponding target if it's not the current branch.
if ctx.Repo.BranchName != rel.Target {
@ -105,9 +109,13 @@ func Releases(ctx *middleware.Context) {
rel.Publisher, err = models.GetUserByID(rel.PublisherID)
if err != nil {
if models.IsErrUserNotExist(err) {
rel.Publisher = models.NewFakeUser()
} else {
ctx.Handle(500, "GetUserByID", err)
return
}
}
// FIXME: duplicated code.
// Get corresponding target if it's not the current branch.
if ctx.Repo.BranchName != rel.Target {