Implemented Basic Setting of Issue Dependencies

Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
kolaente 2017-09-03 21:51:22 +02:00 committed by Konrad
parent 24514ba1c4
commit 4cb857fe0d
6 changed files with 14 additions and 3 deletions

View File

@ -406,6 +406,7 @@ func (repo *Repository) UnitEnabled(tp UnitType) bool {
return true return true
} }
} }
return false return false
} }
@ -666,6 +667,7 @@ func (repo *Repository) CanEnableEditor() bool {
return !repo.IsMirror return !repo.IsMirror
} }
// Find all Dependencies an issue is blocked by
func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) { func (repo *Repository) BlockedByDependencies(issueID int64) (_ []*Issue, err error) {
issueDeps, err := repo.getBlockedByDependencies(x, issueID) issueDeps, err := repo.getBlockedByDependencies(x, issueID)

View File

@ -75,7 +75,7 @@ func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell) {
switch colName { switch colName {
case "type": case "type":
switch UnitType(Cell2Int64(val)) { switch UnitType(Cell2Int64(val)) {
case UnitTypeCode, UnitTypeIssues, UnitTypePullRequests, UnitTypeReleases, case UnitTypeCode, UnitTypeIssues, UnitTypePullRequests, UnitTypeReleases, UnitTypeIssueDependencies,
UnitTypeWiki: UnitTypeWiki:
r.Config = new(UnitConfig) r.Config = new(UnitConfig)
case UnitTypeExternalWiki: case UnitTypeExternalWiki:

View File

@ -120,6 +120,14 @@ var (
4, 4,
} }
UnitIssueDependencies = Unit{
UnitTypeIssueDependencies,
"repo.issue_dependency",
"/issues",
"repo.issue_dependency.desc",
5,
}
// Units contains all the units // Units contains all the units
Units = map[UnitType]Unit{ Units = map[UnitType]Unit{
UnitTypeCode: UnitCode, UnitTypeCode: UnitCode,
@ -129,5 +137,6 @@ var (
UnitTypeReleases: UnitReleases, UnitTypeReleases: UnitReleases,
UnitTypeWiki: UnitWiki, UnitTypeWiki: UnitWiki,
UnitTypeExternalWiki: UnitExternalWiki, UnitTypeExternalWiki: UnitExternalWiki,
UnitTypeIssueDependencies: UnitIssueDependencies,
} }
) )

View File

@ -549,5 +549,6 @@ func UnitTypes() macaron.Handler {
ctx.Data["UnitTypeWiki"] = models.UnitTypeWiki ctx.Data["UnitTypeWiki"] = models.UnitTypeWiki
ctx.Data["UnitTypeExternalWiki"] = models.UnitTypeExternalWiki ctx.Data["UnitTypeExternalWiki"] = models.UnitTypeExternalWiki
ctx.Data["UnitTypeExternalTracker"] = models.UnitTypeExternalTracker ctx.Data["UnitTypeExternalTracker"] = models.UnitTypeExternalTracker
ctx.Data["UnitTypeIssueDependencies"] = models.UnitTypeIssueDependencies
} }
} }

View File

@ -16,7 +16,6 @@ import (
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/setting"
"fmt"
) )
const ( const (

View File

@ -140,7 +140,7 @@
</div> </div>
<div class="field"> <div class="field">
<div class="ui checkbox"> <div class="ui checkbox">
<input name="enable_issue_dependencies" type="checkbox"> <input name="enable_issue_dependencies" type="checkbox" {{if (.Repository.UnitEnabled $.UnitTypeIssueDependencies)}}checked{{end}}>
<label>Issues can have dependencies</label> <label>Issues can have dependencies</label>
</div> </div>
</div> </div>