Implemented Dependencies for pull requests.

Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
Konrad Langenberg 2017-08-29 22:32:29 +02:00 committed by Jonas Franz
parent 21f36f99c6
commit 88025f8d7f
3 changed files with 29 additions and 4 deletions

View File

@ -918,8 +918,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
}
}

View File

@ -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

View File

@ -197,7 +197,13 @@
<span class="text"><strong>{{.i18n.Tr "repo.issues.dependency.title"}}</strong></span>
<br>
{{if .BlockedByDependencies}}
<span class="text">Closing this issue is blocked by:</span>
<span class="text">
{{if .Issue.IsPull}}
Closing this pull request is blocked by:
{{else}}
Closing this issue is blocked by:
{{end}}
</span>
<div class="ui relaxed divided list">
{{range .BlockedByDependencies}}
<div class="item">
@ -224,7 +230,13 @@
{{if .BlockingDependencies}}
<div class="ui relaxed divided list">
<span class="text">This issue blocks closing of the following issues:</span>
<span class="text">
{{if .Issue.IsPull}}
This pull request blocks closing of the following issues:
{{else}}
This issue blocks closing of the following issues:
{{end}}
</span>
{{range .BlockingDependencies}}
<div class="item">
<div class="right floated content">