mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Move user related model into models/user (#17781)
* Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
This commit is contained in:
		@@ -9,6 +9,7 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"code.gitea.io/gitea/models"
 | 
			
		||||
	user_model "code.gitea.io/gitea/models/user"
 | 
			
		||||
	"code.gitea.io/gitea/models/webhook"
 | 
			
		||||
	"code.gitea.io/gitea/modules/setting"
 | 
			
		||||
	"code.gitea.io/gitea/services/auth"
 | 
			
		||||
@@ -33,7 +34,7 @@ func registerUpdateMirrorTask() {
 | 
			
		||||
		},
 | 
			
		||||
		PullLimit: 50,
 | 
			
		||||
		PushLimit: 50,
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, cfg Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, cfg Config) error {
 | 
			
		||||
		umtc := cfg.(*UpdateMirrorTaskConfig)
 | 
			
		||||
		return mirror_service.Update(ctx, umtc.PullLimit, umtc.PushLimit)
 | 
			
		||||
	})
 | 
			
		||||
@@ -53,7 +54,7 @@ func registerRepoHealthCheck() {
 | 
			
		||||
		},
 | 
			
		||||
		Timeout: 60 * time.Second,
 | 
			
		||||
		Args:    []string{},
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, config Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, config Config) error {
 | 
			
		||||
		rhcConfig := config.(*RepoHealthCheckConfig)
 | 
			
		||||
		return repository_service.GitFsck(ctx, rhcConfig.Timeout, rhcConfig.Args)
 | 
			
		||||
	})
 | 
			
		||||
@@ -64,7 +65,7 @@ func registerCheckRepoStats() {
 | 
			
		||||
		Enabled:    true,
 | 
			
		||||
		RunAtStart: true,
 | 
			
		||||
		Schedule:   "@midnight",
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, _ Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, _ Config) error {
 | 
			
		||||
		return models.CheckRepoStats(ctx)
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
@@ -77,7 +78,7 @@ func registerArchiveCleanup() {
 | 
			
		||||
			Schedule:   "@midnight",
 | 
			
		||||
		},
 | 
			
		||||
		OlderThan: 24 * time.Hour,
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, config Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, config Config) error {
 | 
			
		||||
		acConfig := config.(*OlderThanConfig)
 | 
			
		||||
		return models.DeleteOldRepositoryArchives(ctx, acConfig.OlderThan)
 | 
			
		||||
	})
 | 
			
		||||
@@ -91,7 +92,7 @@ func registerSyncExternalUsers() {
 | 
			
		||||
			Schedule:   "@midnight",
 | 
			
		||||
		},
 | 
			
		||||
		UpdateExisting: true,
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, config Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, config Config) error {
 | 
			
		||||
		realConfig := config.(*UpdateExistingConfig)
 | 
			
		||||
		return auth.SyncExternalUsers(ctx, realConfig.UpdateExisting)
 | 
			
		||||
	})
 | 
			
		||||
@@ -105,7 +106,7 @@ func registerDeletedBranchesCleanup() {
 | 
			
		||||
			Schedule:   "@midnight",
 | 
			
		||||
		},
 | 
			
		||||
		OlderThan: 24 * time.Hour,
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, config Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, config Config) error {
 | 
			
		||||
		realConfig := config.(*OlderThanConfig)
 | 
			
		||||
		models.RemoveOldDeletedBranches(ctx, realConfig.OlderThan)
 | 
			
		||||
		return nil
 | 
			
		||||
@@ -117,7 +118,7 @@ func registerUpdateMigrationPosterID() {
 | 
			
		||||
		Enabled:    true,
 | 
			
		||||
		RunAtStart: true,
 | 
			
		||||
		Schedule:   "@midnight",
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, _ Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, _ Config) error {
 | 
			
		||||
		return migrations.UpdateMigrationPosterID(ctx)
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
@@ -132,7 +133,7 @@ func registerCleanupHookTaskTable() {
 | 
			
		||||
		CleanupType:  "OlderThan",
 | 
			
		||||
		OlderThan:    168 * time.Hour,
 | 
			
		||||
		NumberToKeep: 10,
 | 
			
		||||
	}, func(ctx context.Context, _ *models.User, config Config) error {
 | 
			
		||||
	}, func(ctx context.Context, _ *user_model.User, config Config) error {
 | 
			
		||||
		realConfig := config.(*CleanupHookTaskConfig)
 | 
			
		||||
		return webhook.CleanupHookTaskTable(ctx, webhook.ToHookTaskCleanupType(realConfig.CleanupType), realConfig.OlderThan, realConfig.NumberToKeep)
 | 
			
		||||
	})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user