if milestone id is zero don't get it from database (#7174)

This commit is contained in:
Lunny Xiao 2019-06-10 23:29:07 +08:00 committed by GitHub
parent 5e97b2d00e
commit 10effb396a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,12 +406,14 @@ func NewIssue(ctx *context.Context) {
ctx.Data["BodyQuery"] = body ctx.Data["BodyQuery"] = body
milestoneID := ctx.QueryInt64("milestone") milestoneID := ctx.QueryInt64("milestone")
milestone, err := models.GetMilestoneByID(milestoneID) if milestoneID > 0 {
if err != nil { milestone, err := models.GetMilestoneByID(milestoneID)
log.Error(4, "GetMilestoneByID: %d: %v", milestoneID, err) if err != nil {
} else { log.Error(4, "GetMilestoneByID: %d: %v", milestoneID, err)
ctx.Data["milestone_id"] = milestoneID } else {
ctx.Data["Milestone"] = milestone ctx.Data["milestone_id"] = milestoneID
ctx.Data["Milestone"] = milestone
}
} }
setTemplateIfExists(ctx, issueTemplateKey, IssueTemplateCandidates) setTemplateIfExists(ctx, issueTemplateKey, IssueTemplateCandidates)