Fully implemented Repo setting to enable/disable Issue Dependencies
Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
parent
956697a0e9
commit
2a87cd9a06
|
|
@ -131,6 +131,11 @@ func (r *RepoUnit) ExternalTrackerConfig() *ExternalTrackerConfig {
|
|||
return r.Config.(*ExternalTrackerConfig)
|
||||
}
|
||||
|
||||
// IssueDependenciesConfig returns config for UnitTypeIssueDependencies
|
||||
func (r *RepoUnit) IssueDependenciesConfig() *UnitConfig{
|
||||
return r.Config.(*UnitConfig)
|
||||
}
|
||||
|
||||
func getUnitsByRepoID(e Engine, repoID int64) (units []*RepoUnit, err error) {
|
||||
return units, e.Where("repo_id = ?", repoID).Find(&units)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -672,6 +672,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
}
|
||||
|
||||
// Get Dependencies
|
||||
ctx.Data["IssueDependenciesEnabled"] = repo.UnitEnabled(models.UnitTypeIssueDependencies)
|
||||
ctx.Data["BlockedByDependencies"], err = repo.BlockedByDependencies(issue.ID)
|
||||
ctx.Data["BlockingDependencies"], err = repo.BlockingDependencies(issue.ID)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ import (
|
|||
|
||||
// Adds new dependencies
|
||||
func AddDependency(c *context.Context) {
|
||||
|
||||
// TODO: should should an issue only have dependencies in it's own repo?
|
||||
|
||||
depID, err := strconv.ParseInt(c.Req.PostForm.Get("newDependency"), 10, 64)
|
||||
if err != nil {
|
||||
c.Handle(http.StatusBadRequest, "issue ID is not int", err)
|
||||
|
|
@ -28,6 +31,12 @@ func AddDependency(c *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// Check if the Repo is allowed to have dependencies
|
||||
if !c.Repo.Repository.UnitEnabled(models.UnitTypeIssueDependencies) {
|
||||
c.Handle(404, "MustEnableIssueDependencies", nil)
|
||||
return
|
||||
}
|
||||
|
||||
// Dependency
|
||||
dep, err := models.GetIssueByID(depID)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -122,6 +122,7 @@
|
|||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .IssueDependenciesEnabled}}
|
||||
<div class="ui divider"></div>
|
||||
|
||||
<div class="ui depending">
|
||||
|
|
@ -252,3 +253,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user