Simplified checking for open dependencies
Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
parent
837c917798
commit
fe8181af73
|
|
@ -139,7 +139,7 @@ func IssueNoDependenciesLeft(issue *Issue) bool {
|
|||
var issueDeps []IssueDependencyIssue
|
||||
|
||||
err := x.Join("INNER", "issue", "issue.id = issue_dependency.issue_id").Find(&issueDeps)
|
||||
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -920,18 +920,15 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
|
|||
!(issue.IsPull && issue.PullRequest.HasMerged) {
|
||||
|
||||
// Check for open dependencies
|
||||
if form.Status == "close" {
|
||||
|
||||
if models.IssueNoDependenciesLeft(issue) {
|
||||
if issue.IsPull {
|
||||
ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!")
|
||||
ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index))
|
||||
} else {
|
||||
ctx.Flash.Error("You need to close all issues blocking this issue before you can close it!")
|
||||
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index))
|
||||
}
|
||||
return
|
||||
if form.Status == "close" && models.IssueNoDependenciesLeft(issue) {
|
||||
if issue.IsPull {
|
||||
ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!")
|
||||
ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index))
|
||||
} else {
|
||||
ctx.Flash.Error("You need to close all issues blocking this issue before you can close it!")
|
||||
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Duplication and conflict check should apply to reopen pull request.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user