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