Avoid double imports (#17569)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
		
							parent
							
								
									513951bc16
								
							
						
					
					
						commit
						ebaf4c48ea
					
				|  | @ -23,3 +23,4 @@ warningCode = 1 | |||
| [rule.unexported-return] | ||||
| [rule.indent-error-flow] | ||||
| [rule.errorf] | ||||
| [rule.duplicated-imports] | ||||
|  |  | |||
|  | @ -18,7 +18,6 @@ import ( | |||
| 	"code.gitea.io/gitea/modules/base" | ||||
| 	"code.gitea.io/gitea/modules/log" | ||||
| 	"code.gitea.io/gitea/modules/references" | ||||
| 	"code.gitea.io/gitea/modules/structs" | ||||
| 	api "code.gitea.io/gitea/modules/structs" | ||||
| 	"code.gitea.io/gitea/modules/timeutil" | ||||
| 	"code.gitea.io/gitea/modules/util" | ||||
|  | @ -2116,7 +2115,7 @@ func (issue *Issue) ResolveMentionsByVisibility(ctx context.Context, doer *User, | |||
| } | ||||
| 
 | ||||
| // UpdateIssuesMigrationsByType updates all migrated repositories' issues from gitServiceType to replace originalAuthorID to posterID
 | ||||
| func UpdateIssuesMigrationsByType(gitServiceType structs.GitServiceType, originalAuthorID string, posterID int64) error { | ||||
| func UpdateIssuesMigrationsByType(gitServiceType api.GitServiceType, originalAuthorID string, posterID int64) error { | ||||
| 	_, err := db.GetEngine(db.DefaultContext).Table("issue"). | ||||
| 		Where("repo_id IN (SELECT id FROM repository WHERE original_service_type = ?)", gitServiceType). | ||||
| 		And("original_author_id = ?", originalAuthorID). | ||||
|  | @ -2129,7 +2128,7 @@ func UpdateIssuesMigrationsByType(gitServiceType structs.GitServiceType, origina | |||
| } | ||||
| 
 | ||||
| // UpdateReactionsMigrationsByType updates all migrated repositories' reactions from gitServiceType to replace originalAuthorID to posterID
 | ||||
| func UpdateReactionsMigrationsByType(gitServiceType structs.GitServiceType, originalAuthorID string, userID int64) error { | ||||
| func UpdateReactionsMigrationsByType(gitServiceType api.GitServiceType, originalAuthorID string, userID int64) error { | ||||
| 	_, err := db.GetEngine(db.DefaultContext).Table("reaction"). | ||||
| 		Where("original_author_id = ?", originalAuthorID). | ||||
| 		And(migratedIssueCond(gitServiceType)). | ||||
|  |  | |||
|  | @ -15,7 +15,6 @@ import ( | |||
| 	"code.gitea.io/gitea/models/login" | ||||
| 	"code.gitea.io/gitea/modules/git" | ||||
| 	"code.gitea.io/gitea/modules/log" | ||||
| 	"code.gitea.io/gitea/modules/structs" | ||||
| 	api "code.gitea.io/gitea/modules/structs" | ||||
| 	"code.gitea.io/gitea/modules/util" | ||||
| 	"code.gitea.io/gitea/services/webhook" | ||||
|  | @ -158,7 +157,7 @@ func ToVerification(c *git.Commit) *api.PayloadCommitVerification { | |||
| 		commitVerification.Payload = c.Signature.Payload | ||||
| 	} | ||||
| 	if verif.SigningUser != nil { | ||||
| 		commitVerification.Signer = &structs.PayloadUser{ | ||||
| 		commitVerification.Signer = &api.PayloadUser{ | ||||
| 			Name:  verif.SigningUser.Name, | ||||
| 			Email: verif.SigningUser.Email, | ||||
| 		} | ||||
|  |  | |||
|  | @ -20,7 +20,6 @@ import ( | |||
| 	"code.gitea.io/gitea/modules/git" | ||||
| 	"code.gitea.io/gitea/modules/log" | ||||
| 	"code.gitea.io/gitea/modules/migrations/base" | ||||
| 	"code.gitea.io/gitea/modules/repository" | ||||
| 	repo_module "code.gitea.io/gitea/modules/repository" | ||||
| 	"code.gitea.io/gitea/modules/setting" | ||||
| 	"code.gitea.io/gitea/modules/storage" | ||||
|  | @ -111,7 +110,7 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate | |||
| 	} | ||||
| 	r.DefaultBranch = repo.DefaultBranch | ||||
| 
 | ||||
| 	r, err = repository.MigrateRepositoryGitData(g.ctx, owner, r, base.MigrateOptions{ | ||||
| 	r, err = repo_module.MigrateRepositoryGitData(g.ctx, owner, r, base.MigrateOptions{ | ||||
| 		RepoName:       g.repoName, | ||||
| 		Description:    repo.Description, | ||||
| 		OriginalURL:    repo.OriginalURL, | ||||
|  | @ -341,7 +340,7 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error { | |||
| 
 | ||||
| // SyncTags syncs releases with tags in the database
 | ||||
| func (g *GiteaLocalUploader) SyncTags() error { | ||||
| 	return repository.SyncReleasesWithTags(g.repo, g.gitRepo) | ||||
| 	return repo_module.SyncReleasesWithTags(g.repo, g.gitRepo) | ||||
| } | ||||
| 
 | ||||
| // CreateIssues creates issues
 | ||||
|  |  | |||
|  | @ -12,7 +12,6 @@ import ( | |||
| 	"code.gitea.io/gitea/modules/context" | ||||
| 	"code.gitea.io/gitea/modules/convert" | ||||
| 	"code.gitea.io/gitea/modules/log" | ||||
| 	"code.gitea.io/gitea/modules/structs" | ||||
| 	api "code.gitea.io/gitea/modules/structs" | ||||
| 	"code.gitea.io/gitea/modules/web" | ||||
| 	repo_service "code.gitea.io/gitea/services/repository" | ||||
|  | @ -65,7 +64,7 @@ func Transfer(ctx *context.APIContext) { | |||
| 	} | ||||
| 
 | ||||
| 	if newOwner.Type == models.UserTypeOrganization { | ||||
| 		if !ctx.User.IsAdmin && newOwner.Visibility == structs.VisibleTypePrivate && !newOwner.HasMemberWithUserID(ctx.User.ID) { | ||||
| 		if !ctx.User.IsAdmin && newOwner.Visibility == api.VisibleTypePrivate && !newOwner.HasMemberWithUserID(ctx.User.ID) { | ||||
| 			// The user shouldn't know about this organization
 | ||||
| 			ctx.Error(http.StatusNotFound, "", "The new owner does not exist or cannot be found") | ||||
| 			return | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue