mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	refactor some functions to support ctx as first parameter (#21878)
Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		@@ -78,7 +78,7 @@ var pullRequestTemplateCandidates = []string{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getRepository(ctx *context.Context, repoID int64) *repo_model.Repository {
 | 
			
		||||
	repo, err := repo_model.GetRepositoryByID(repoID)
 | 
			
		||||
	repo, err := repo_model.GetRepositoryByID(ctx, repoID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if repo_model.IsErrRepoNotExist(err) {
 | 
			
		||||
			ctx.NotFound("GetRepositoryByID", nil)
 | 
			
		||||
@@ -159,7 +159,7 @@ func getForkRepository(ctx *context.Context) *repo_model.Repository {
 | 
			
		||||
		if !traverseParentRepo.IsFork {
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
		traverseParentRepo, err = repo_model.GetRepositoryByID(traverseParentRepo.ForkID)
 | 
			
		||||
		traverseParentRepo, err = repo_model.GetRepositoryByID(ctx, traverseParentRepo.ForkID)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			ctx.ServerError("GetRepositoryByID", err)
 | 
			
		||||
			return nil
 | 
			
		||||
@@ -227,7 +227,7 @@ func ForkPost(ctx *context.Context) {
 | 
			
		||||
		if !traverseParentRepo.IsFork {
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
		traverseParentRepo, err = repo_model.GetRepositoryByID(traverseParentRepo.ForkID)
 | 
			
		||||
		traverseParentRepo, err = repo_model.GetRepositoryByID(ctx, traverseParentRepo.ForkID)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			ctx.ServerError("GetRepositoryByID", err)
 | 
			
		||||
			return
 | 
			
		||||
@@ -427,7 +427,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
 | 
			
		||||
 | 
			
		||||
	setMergeTarget(ctx, pull)
 | 
			
		||||
 | 
			
		||||
	if err := pull.LoadProtectedBranch(); err != nil {
 | 
			
		||||
	if err := pull.LoadProtectedBranch(ctx); err != nil {
 | 
			
		||||
		ctx.ServerError("LoadProtectedBranch", err)
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
@@ -739,7 +739,7 @@ func ViewPullFiles(ctx *context.Context) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err = pull.LoadProtectedBranch(); err != nil {
 | 
			
		||||
	if err = pull.LoadProtectedBranch(ctx); err != nil {
 | 
			
		||||
		ctx.ServerError("LoadProtectedBranch", err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user