Simplified checks for open dependencies

Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
Konrad Langenberg 2017-09-23 16:11:16 +02:00 committed by Konrad
parent c1ea3f588d
commit 1b8b2fc17d
2 changed files with 2 additions and 5 deletions

View File

@ -922,9 +922,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
// Check for open dependencies // Check for open dependencies
if form.Status == "close" { if form.Status == "close" {
canbeClosed := models.IssueNoDependenciesLeft(issue) if models.IssueNoDependenciesLeft(issue) {
if !canbeClosed {
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))

View File

@ -428,9 +428,8 @@ func MergePullRequest(ctx *context.Context) {
pr.Issue = issue pr.Issue = issue
pr.Issue.Repo = ctx.Repo.Repository pr.Issue.Repo = ctx.Repo.Repository
canbeClosed := models.IssueNoDependenciesLeft(issue)
if !canbeClosed { if !models.IssueNoDependenciesLeft(issue) {
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(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index)) ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index))
return return