From 1b8b2fc17d0aed676a91ae7b45d05395563334d8 Mon Sep 17 00:00:00 2001 From: Konrad Langenberg Date: Sat, 23 Sep 2017 16:11:16 +0200 Subject: [PATCH] Simplified checks for open dependencies Signed-off-by: Konrad --- routers/repo/issue.go | 4 +--- routers/repo/pull.go | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index cd519b690..87b11c206 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -922,9 +922,7 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) { // Check for open dependencies if form.Status == "close" { - canbeClosed := models.IssueNoDependenciesLeft(issue) - - if !canbeClosed { + 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)) diff --git a/routers/repo/pull.go b/routers/repo/pull.go index caeddaa00..ef7096863 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -428,9 +428,8 @@ func MergePullRequest(ctx *context.Context) { pr.Issue = issue 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.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index)) return