summaryrefslogtreecommitdiffstats
path: root/services/migrations
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-18 13:58:42 +0800
committerGitHub <noreply@github.com>2021-11-18 13:58:42 +0800
commit3c3855a05c79ccc7a8495cdbf4a361e7bef74248 (patch)
tree43f8616bca25a09c0e284e9407819ba43a6a0d79 /services/migrations
parent6874fe90e591fa1bfb4b0575b27d876ab544e6e0 (diff)
downloadgitea-3c3855a05c79ccc7a8495cdbf4a361e7bef74248.tar.gz
gitea-3c3855a05c79ccc7a8495cdbf4a361e7bef74248.zip
Move user functions into user.go (#17659)
* Move user functions into user.go * Fix test
Diffstat (limited to 'services/migrations')
-rw-r--r--services/migrations/gitea_downloader.go8
-rw-r--r--services/migrations/migrate.go3
2 files changed, 6 insertions, 5 deletions
diff --git a/services/migrations/gitea_downloader.go b/services/migrations/gitea_downloader.go
index 51ef0292df..00180adf41 100644
--- a/services/migrations/gitea_downloader.go
+++ b/services/migrations/gitea_downloader.go
@@ -15,7 +15,7 @@ import (
"strings"
"time"
- "code.gitea.io/gitea/models"
+ admin_model "code.gitea.io/gitea/models/admin"
"code.gitea.io/gitea/modules/log"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/proxy"
@@ -417,7 +417,7 @@ func (g *GiteaDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, err
reactions, err := g.getIssueReactions(issue.Index)
if err != nil {
log.Warn("Unable to load reactions during migrating issue #%d to %s/%s. Error: %v", issue.Index, g.repoOwner, g.repoName, err)
- if err2 := models.CreateRepositoryNotice(
+ if err2 := admin_model.CreateRepositoryNotice(
fmt.Sprintf("Unable to load reactions during migrating issue #%d to %s/%s. Error: %v", issue.Index, g.repoOwner, g.repoName, err)); err2 != nil {
log.Error("create repository notice failed: ", err2)
}
@@ -479,7 +479,7 @@ func (g *GiteaDownloader) GetComments(opts base.GetCommentOptions) ([]*base.Comm
reactions, err := g.getCommentReactions(comment.ID)
if err != nil {
log.Warn("Unable to load comment reactions during migrating issue #%d for comment %d to %s/%s. Error: %v", opts.Context.ForeignID(), comment.ID, g.repoOwner, g.repoName, err)
- if err2 := models.CreateRepositoryNotice(
+ if err2 := admin_model.CreateRepositoryNotice(
fmt.Sprintf("Unable to load reactions during migrating issue #%d for comment %d to %s/%s. Error: %v", opts.Context.ForeignID(), comment.ID, g.repoOwner, g.repoName, err)); err2 != nil {
log.Error("create repository notice failed: ", err2)
}
@@ -557,7 +557,7 @@ func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullReques
reactions, err := g.getIssueReactions(pr.Index)
if err != nil {
log.Warn("Unable to load reactions during migrating pull #%d to %s/%s. Error: %v", pr.Index, g.repoOwner, g.repoName, err)
- if err2 := models.CreateRepositoryNotice(
+ if err2 := admin_model.CreateRepositoryNotice(
fmt.Sprintf("Unable to load reactions during migrating pull #%d to %s/%s. Error: %v", pr.Index, g.repoOwner, g.repoName, err)); err2 != nil {
log.Error("create repository notice failed: ", err2)
}
diff --git a/services/migrations/migrate.go b/services/migrations/migrate.go
index 21be2d3b0d..e6d5e8e4cc 100644
--- a/services/migrations/migrate.go
+++ b/services/migrations/migrate.go
@@ -14,6 +14,7 @@ import (
"strings"
"code.gitea.io/gitea/models"
+ admin_model "code.gitea.io/gitea/models/admin"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/matchlist"
base "code.gitea.io/gitea/modules/migration"
@@ -122,7 +123,7 @@ func MigrateRepository(ctx context.Context, doer *models.User, ownerName string,
if err1 := uploader.Rollback(); err1 != nil {
log.Error("rollback failed: %v", err1)
}
- if err2 := models.CreateRepositoryNotice(fmt.Sprintf("Migrate repository from %s failed: %v", opts.OriginalURL, err)); err2 != nil {
+ if err2 := admin_model.CreateRepositoryNotice(fmt.Sprintf("Migrate repository from %s failed: %v", opts.OriginalURL, err)); err2 != nil {
log.Error("create respotiry notice failed: ", err2)
}
return nil, err