mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Move unit into models/unit/ (#17576)
* Move unit into models/unit/ * Rename unit.UnitType as unit.Type
This commit is contained in:
		@@ -12,6 +12,7 @@ import (
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	"code.gitea.io/gitea/models/db"
 | 
			
		||||
	unit_model "code.gitea.io/gitea/models/unit"
 | 
			
		||||
	api "code.gitea.io/gitea/modules/structs"
 | 
			
		||||
 | 
			
		||||
	"github.com/stretchr/testify/assert"
 | 
			
		||||
@@ -26,7 +27,7 @@ func getRepoEditOptionFromRepo(repo *models.Repository) *api.EditRepoOption {
 | 
			
		||||
	hasIssues := false
 | 
			
		||||
	var internalTracker *api.InternalTracker
 | 
			
		||||
	var externalTracker *api.ExternalTracker
 | 
			
		||||
	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{
 | 
			
		||||
@@ -34,7 +35,7 @@ func getRepoEditOptionFromRepo(repo *models.Repository) *api.EditRepoOption {
 | 
			
		||||
			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{
 | 
			
		||||
@@ -45,9 +46,9 @@ func getRepoEditOptionFromRepo(repo *models.Repository) *api.EditRepoOption {
 | 
			
		||||
	}
 | 
			
		||||
	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{
 | 
			
		||||
@@ -61,7 +62,7 @@ func getRepoEditOptionFromRepo(repo *models.Repository) *api.EditRepoOption {
 | 
			
		||||
	allowRebase := false
 | 
			
		||||
	allowRebaseMerge := false
 | 
			
		||||
	allowSquash := false
 | 
			
		||||
	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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user