diff --git a/routers/repo/issue.go b/routers/repo/issue.go
index ff51b6aaa..d280717ab 100644
--- a/routers/repo/issue.go
+++ b/routers/repo/issue.go
@@ -874,8 +874,13 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
canbeClosed := models.IssueNoDependenciesLeft(issue.ID)
if !canbeClosed {
- ctx.Flash.Error("You need to close all issues blocking this issue!")
- ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index))
+ 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))
+ } else {
+ 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
}
}
diff --git a/routers/repo/pull.go b/routers/repo/pull.go
index ad4a01ec9..7b3296403 100644
--- a/routers/repo/pull.go
+++ b/routers/repo/pull.go
@@ -428,6 +428,14 @@ func MergePullRequest(ctx *context.Context) {
pr.Issue = issue
pr.Issue.Repo = ctx.Repo.Repository
+ canbeClosed := models.IssueNoDependenciesLeft(issue.ID)
+
+ if !canbeClosed {
+ 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
+ }
+
if err = pr.Merge(ctx.User, ctx.Repo.GitRepo); err != nil {
ctx.Handle(500, "Merge", err)
return
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 5daa83453..27f17c314 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -128,7 +128,13 @@
{{.i18n.Tr "repo.issues.dependency.title"}}
{{if .BlockedByDependencies}}
- Closing this issue is blocked by:
+
+ {{if .Issue.IsPull}}
+ Closing this pull request is blocked by:
+ {{else}}
+ Closing this issue is blocked by:
+ {{end}}
+