mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Rename almost all Ctx functions (#22071)
This commit is contained in:
		| @@ -163,13 +163,13 @@ func (r *Repository) CanUseTimetracker(issue *issues_model.Issue, user *user_mod | ||||
| 	// 1. Is timetracker enabled | ||||
| 	// 2. Is the user a contributor, admin, poster or assignee and do the repository policies require this? | ||||
| 	isAssigned, _ := issues_model.IsUserAssignedToIssue(db.DefaultContext, issue, user) | ||||
| 	return r.Repository.IsTimetrackerEnabled() && (!r.Repository.AllowOnlyContributorsToTrackTime() || | ||||
| 	return r.Repository.IsTimetrackerEnabled(db.DefaultContext) && (!r.Repository.AllowOnlyContributorsToTrackTime(db.DefaultContext) || | ||||
| 		r.Permission.CanWriteIssuesOrPulls(issue.IsPull) || issue.IsPoster(user.ID) || isAssigned) | ||||
| } | ||||
|  | ||||
| // CanCreateIssueDependencies returns whether or not a user can create dependencies. | ||||
| func (r *Repository) CanCreateIssueDependencies(user *user_model.User, isPull bool) bool { | ||||
| 	return r.Repository.IsDependenciesEnabled() && r.Permission.CanWriteIssuesOrPulls(isPull) | ||||
| 	return r.Repository.IsDependenciesEnabled(db.DefaultContext) && r.Permission.CanWriteIssuesOrPulls(isPull) | ||||
| } | ||||
|  | ||||
| // GetCommitsCount returns cached commit count for current view | ||||
| @@ -528,12 +528,12 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { | ||||
| 	ctx.Data["RepoLink"] = ctx.Repo.RepoLink | ||||
| 	ctx.Data["RepoRelPath"] = ctx.Repo.Owner.Name + "/" + ctx.Repo.Repository.Name | ||||
|  | ||||
| 	unit, err := ctx.Repo.Repository.GetUnit(unit_model.TypeExternalTracker) | ||||
| 	unit, err := ctx.Repo.Repository.GetUnit(ctx, unit_model.TypeExternalTracker) | ||||
| 	if err == nil { | ||||
| 		ctx.Data["RepoExternalIssuesLink"] = unit.ExternalTrackerConfig().ExternalTrackerURL | ||||
| 	} | ||||
|  | ||||
| 	ctx.Data["NumTags"], err = repo_model.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{ | ||||
| 	ctx.Data["NumTags"], err = repo_model.GetReleaseCountByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{ | ||||
| 		IncludeDrafts: true, | ||||
| 		IncludeTags:   true, | ||||
| 		HasSha1:       util.OptionalBoolTrue, // only draft releases which are created with existing tags | ||||
| @@ -542,7 +542,7 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { | ||||
| 		ctx.ServerError("GetReleaseCountByRepoID", err) | ||||
| 		return | ||||
| 	} | ||||
| 	ctx.Data["NumReleases"], err = repo_model.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{}) | ||||
| 	ctx.Data["NumReleases"], err = repo_model.GetReleaseCountByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{}) | ||||
| 	if err != nil { | ||||
| 		ctx.ServerError("GetReleaseCountByRepoID", err) | ||||
| 		return | ||||
| @@ -723,13 +723,13 @@ func RepoAssignment(ctx *Context) (cancel context.CancelFunc) { | ||||
| 	ctx.Data["PullRequestCtx"] = ctx.Repo.PullRequest | ||||
|  | ||||
| 	if ctx.Repo.Repository.Status == repo_model.RepositoryPendingTransfer { | ||||
| 		repoTransfer, err := models.GetPendingRepositoryTransfer(ctx.Repo.Repository) | ||||
| 		repoTransfer, err := models.GetPendingRepositoryTransfer(ctx, ctx.Repo.Repository) | ||||
| 		if err != nil { | ||||
| 			ctx.ServerError("GetPendingRepositoryTransfer", err) | ||||
| 			return | ||||
| 		} | ||||
|  | ||||
| 		if err := repoTransfer.LoadAttributes(); err != nil { | ||||
| 		if err := repoTransfer.LoadAttributes(ctx); err != nil { | ||||
| 			ctx.ServerError("LoadRecipient", err) | ||||
| 			return | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user