summaryrefslogtreecommitdiffstats
path: root/modules/convert/repository.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-10 03:57:58 +0800
committerGitHub <noreply@github.com>2021-11-09 20:57:58 +0100
commit99b2858e628d92bba252be72def409af77af735b (patch)
tree56159cf10b271307911e6f01626c0c3efba789ab /modules/convert/repository.go
parentb6b1e716654fec3b16d245ef65cf42e57e1bb5b6 (diff)
downloadgitea-99b2858e628d92bba252be72def409af77af735b.tar.gz
gitea-99b2858e628d92bba252be72def409af77af735b.zip
Move unit into models/unit/ (#17576)
* Move unit into models/unit/ * Rename unit.UnitType as unit.Type
Diffstat (limited to 'modules/convert/repository.go')
-rw-r--r--modules/convert/repository.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/convert/repository.go b/modules/convert/repository.go
index 7f3d67137f..bb8217908d 100644
--- a/modules/convert/repository.go
+++ b/modules/convert/repository.go
@@ -6,6 +6,7 @@ package convert
import (
"code.gitea.io/gitea/models"
+ unit_model "code.gitea.io/gitea/models/unit"
api "code.gitea.io/gitea/modules/structs"
)
@@ -37,7 +38,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool)
hasIssues := false
var externalTracker *api.ExternalTracker
var internalTracker *api.InternalTracker
- if unit, err := repo.GetUnit(models.UnitTypeIssues); err == nil {
+ if unit, err := repo.GetUnit(unit_model.TypeIssues); err == nil {
config := unit.IssuesConfig()
hasIssues = true
internalTracker = &api.InternalTracker{
@@ -45,7 +46,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool)
AllowOnlyContributorsToTrackTime: config.AllowOnlyContributorsToTrackTime,
EnableIssueDependencies: config.EnableDependencies,
}
- } else if unit, err := repo.GetUnit(models.UnitTypeExternalTracker); err == nil {
+ } else if unit, err := repo.GetUnit(unit_model.TypeExternalTracker); err == nil {
config := unit.ExternalTrackerConfig()
hasIssues = true
externalTracker = &api.ExternalTracker{
@@ -56,9 +57,9 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool)
}
hasWiki := false
var externalWiki *api.ExternalWiki
- if _, err := repo.GetUnit(models.UnitTypeWiki); err == nil {
+ if _, err := repo.GetUnit(unit_model.TypeWiki); err == nil {
hasWiki = true
- } else if unit, err := repo.GetUnit(models.UnitTypeExternalWiki); err == nil {
+ } else if unit, err := repo.GetUnit(unit_model.TypeExternalWiki); err == nil {
hasWiki = true
config := unit.ExternalWikiConfig()
externalWiki = &api.ExternalWiki{
@@ -72,7 +73,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool)
allowRebaseMerge := false
allowSquash := false
defaultMergeStyle := models.MergeStyleMerge
- if unit, err := repo.GetUnit(models.UnitTypePullRequests); err == nil {
+ if unit, err := repo.GetUnit(unit_model.TypePullRequests); err == nil {
config := unit.PullRequestsConfig()
hasPullRequests = true
ignoreWhitespaceConflicts = config.IgnoreWhitespaceConflicts
@@ -83,7 +84,7 @@ func innerToRepo(repo *models.Repository, mode models.AccessMode, isParent bool)
defaultMergeStyle = config.GetDefaultMergeStyle()
}
hasProjects := false
- if _, err := repo.GetUnit(models.UnitTypeProjects); err == nil {
+ if _, err := repo.GetUnit(unit_model.TypeProjects); err == nil {
hasProjects = true
}