mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
models/issue: improve quality and performance of NewIssue function
This commit is contained in:
parent
4a46613916
commit
4042d1f0c3
13 changed files with 146 additions and 173 deletions
|
@ -754,9 +754,9 @@ func UpdateIssueMilestone(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
oldMid := issue.MilestoneID
|
||||
mid := ctx.QueryInt64("id")
|
||||
if oldMid == mid {
|
||||
oldMilestoneID := issue.MilestoneID
|
||||
milestoneID := ctx.QueryInt64("id")
|
||||
if oldMilestoneID == milestoneID {
|
||||
ctx.JSON(200, map[string]interface{}{
|
||||
"ok": true,
|
||||
})
|
||||
|
@ -764,8 +764,8 @@ func UpdateIssueMilestone(ctx *context.Context) {
|
|||
}
|
||||
|
||||
// Not check for invalid milestone id and give responsibility to owners.
|
||||
issue.MilestoneID = mid
|
||||
if err := models.ChangeMilestoneAssign(oldMid, issue); err != nil {
|
||||
issue.MilestoneID = milestoneID
|
||||
if err := models.ChangeMilestoneAssign(issue, oldMilestoneID); err != nil {
|
||||
ctx.Handle(500, "ChangeMilestoneAssign", err)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue