Fixed issue where an issue could not be closed because of non-existing unresolved dependencies
Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
parent
021a7e0ecf
commit
55f6cf9c91
|
|
@ -141,7 +141,7 @@ func (IssueDependencyIssue) TableName() string {
|
||||||
func IssueNoDependenciesLeft(issue *Issue) bool {
|
func IssueNoDependenciesLeft(issue *Issue) bool {
|
||||||
|
|
||||||
exists, err := x.
|
exists, err := x.
|
||||||
Join("INNER", "issue", "issue.id = issue_dependency.issue_id").
|
Join("INNER", "issue", "issue.id = issue_dependency.dependency_id").
|
||||||
Where("issue_dependency.issue_id = ?", issue.ID).
|
Where("issue_dependency.issue_id = ?", issue.ID).
|
||||||
And("issue.is_closed = ?", "0").
|
And("issue.is_closed = ?", "0").
|
||||||
Exist(&IssueDependencyIssue{})
|
Exist(&IssueDependencyIssue{})
|
||||||
|
|
@ -150,9 +150,5 @@ func IssueNoDependenciesLeft(issue *Issue) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if exists{
|
return !exists
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -920,7 +920,7 @@ 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" && models.IssueNoDependenciesLeft(issue) {
|
if form.Status == "close" && !models.IssueNoDependenciesLeft(issue) {
|
||||||
if issue.IsPull {
|
if issue.IsPull {
|
||||||
ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!")
|
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))
|
ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user