aboutsummaryrefslogtreecommitdiffstats
path: root/services/task
diff options
context:
space:
mode:
Diffstat (limited to 'services/task')
-rw-r--r--services/task/migrate.go12
-rw-r--r--services/task/task.go5
2 files changed, 10 insertions, 7 deletions
diff --git a/services/task/migrate.go b/services/task/migrate.go
index 100aac1967..46ea80b002 100644
--- a/services/task/migrate.go
+++ b/services/task/migrate.go
@@ -11,6 +11,8 @@ import (
"strings"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
@@ -23,16 +25,16 @@ import (
"code.gitea.io/gitea/services/migrations"
)
-func handleCreateError(owner *models.User, err error) error {
+func handleCreateError(owner *user_model.User, err error) error {
switch {
case models.IsErrReachLimitOfRepo(err):
return fmt.Errorf("You have already reached your limit of %d repositories", owner.MaxCreationLimit())
case models.IsErrRepoAlreadyExist(err):
return errors.New("The repository name is already used")
- case models.IsErrNameReserved(err):
- return fmt.Errorf("The repository name '%s' is reserved", err.(models.ErrNameReserved).Name)
- case models.IsErrNamePatternNotAllowed(err):
- return fmt.Errorf("The pattern '%s' is not allowed in a repository name", err.(models.ErrNamePatternNotAllowed).Pattern)
+ case db.IsErrNameReserved(err):
+ return fmt.Errorf("The repository name '%s' is reserved", err.(db.ErrNameReserved).Name)
+ case db.IsErrNamePatternNotAllowed(err):
+ return fmt.Errorf("The pattern '%s' is not allowed in a repository name", err.(db.ErrNamePatternNotAllowed).Pattern)
default:
return err
}
diff --git a/services/task/task.go b/services/task/task.go
index f538b36efc..350b8206b2 100644
--- a/services/task/task.go
+++ b/services/task/task.go
@@ -8,6 +8,7 @@ import (
"fmt"
"code.gitea.io/gitea/models"
+ user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
@@ -57,7 +58,7 @@ func handle(data ...queue.Data) {
}
// MigrateRepository add migration repository to task
-func MigrateRepository(doer, u *models.User, opts base.MigrateOptions) error {
+func MigrateRepository(doer, u *user_model.User, opts base.MigrateOptions) error {
task, err := CreateMigrateTask(doer, u, opts)
if err != nil {
return err
@@ -67,7 +68,7 @@ func MigrateRepository(doer, u *models.User, opts base.MigrateOptions) error {
}
// CreateMigrateTask creates a migrate task
-func CreateMigrateTask(doer, u *models.User, opts base.MigrateOptions) (*models.Task, error) {
+func CreateMigrateTask(doer, u *user_model.User, opts base.MigrateOptions) (*models.Task, error) {
// encrypt credentials for persistence
var err error
opts.CloneAddrEncrypted, err = secret.EncryptSecret(setting.SecretKey, opts.CloneAddr)