summaryrefslogtreecommitdiffstats
path: root/routers/repo/pull.go
diff options
context:
space:
mode:
authorkolaente <konrad@kola-entertainments.de>2018-07-17 23:23:58 +0200
committertechknowlogick <techknowlogick@users.noreply.github.com>2018-07-17 17:23:58 -0400
commit1bff02de55331e11de3627d5c5628feb2cd97387 (patch)
treed6d6ace5f246c1555b294bf096763260f7d74d7b /routers/repo/pull.go
parent7be5935c55dcdf198efdf1306bbeb2b54aa0b900 (diff)
downloadgitea-1bff02de55331e11de3627d5c5628feb2cd97387.tar.gz
gitea-1bff02de55331e11de3627d5c5628feb2cd97387.zip
Added dependencies for issues (#2196) (#2531)
Diffstat (limited to 'routers/repo/pull.go')
-rw-r--r--routers/repo/pull.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index dfe07ca44a..c8d65731ee 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -524,6 +524,18 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
pr.Issue = issue
pr.Issue.Repo = ctx.Repo.Repository
+
+ noDeps, err := models.IssueNoDependenciesLeft(issue)
+ if err != nil {
+ return
+ }
+
+ if !noDeps {
+ ctx.Flash.Error(ctx.Tr("repo.issues.dependency.pr_close_blocked"))
+ ctx.Redirect(ctx.Repo.RepoLink + "/pulls/" + com.ToStr(pr.Index))
+ return
+ }
+
if err = pr.Merge(ctx.User, ctx.Repo.GitRepo, models.MergeStyle(form.Do), message); err != nil {
if models.IsErrInvalidMergeStyle(err) {
ctx.Flash.Error(ctx.Tr("repo.pulls.invalid_merge_option"))