Don't attempt to close issue if already closed (#9696)

Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
guillep2k 2020-01-10 22:20:11 -03:00 committed by Lunny Xiao
parent 438e159d04
commit 705b1e49a8
2 changed files with 9 additions and 5 deletions

View File

@ -138,12 +138,14 @@ func UpdateIssuesCommit(doer *models.User, repo *models.Repository, commits []*r
continue
}
}
if err := changeIssueStatus(refRepo, refIssue, doer, ref.Action == references.XRefActionCloses); err != nil {
close := (ref.Action == references.XRefActionCloses)
if close != refIssue.IsClosed {
if err := changeIssueStatus(refRepo, refIssue, doer, close); err != nil {
return err
}
}
}
}
return nil
}

View File

@ -374,10 +374,12 @@ func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repositor
return err
}
close := (ref.RefAction == references.XRefActionCloses)
if close != ref.Issue.IsClosed {
if err = issue_service.ChangeStatus(ref.Issue, doer, close); err != nil {
return err
}
}
}
return nil
}