mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-25 11:22:16 +00:00
Penultimate round of db.DefaultContext
refactor (#27414)
Part of #27065 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
50166d1f7c
commit
ebe803e514
136 changed files with 428 additions and 421 deletions
|
@ -495,7 +495,7 @@ func Issues(ctx *context.Context) {
|
|||
|
||||
func renderMilestones(ctx *context.Context) {
|
||||
// Get milestones
|
||||
milestones, _, err := issues_model.GetMilestones(issues_model.GetMilestonesOption{
|
||||
milestones, _, err := issues_model.GetMilestones(ctx, issues_model.GetMilestonesOption{
|
||||
RepoID: ctx.Repo.Repository.ID,
|
||||
State: api.StateAll,
|
||||
})
|
||||
|
@ -519,7 +519,7 @@ func renderMilestones(ctx *context.Context) {
|
|||
// RetrieveRepoMilestonesAndAssignees find all the milestones and assignees of a repository
|
||||
func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *repo_model.Repository) {
|
||||
var err error
|
||||
ctx.Data["OpenMilestones"], _, err = issues_model.GetMilestones(issues_model.GetMilestonesOption{
|
||||
ctx.Data["OpenMilestones"], _, err = issues_model.GetMilestones(ctx, issues_model.GetMilestonesOption{
|
||||
RepoID: repo.ID,
|
||||
State: api.StateOpen,
|
||||
})
|
||||
|
@ -527,7 +527,7 @@ func RetrieveRepoMilestonesAndAssignees(ctx *context.Context, repo *repo_model.R
|
|||
ctx.ServerError("GetMilestones", err)
|
||||
return
|
||||
}
|
||||
ctx.Data["ClosedMilestones"], _, err = issues_model.GetMilestones(issues_model.GetMilestonesOption{
|
||||
ctx.Data["ClosedMilestones"], _, err = issues_model.GetMilestones(ctx, issues_model.GetMilestonesOption{
|
||||
RepoID: repo.ID,
|
||||
State: api.StateClosed,
|
||||
})
|
||||
|
@ -1229,7 +1229,7 @@ func NewIssuePost(ctx *context.Context) {
|
|||
ctx.Error(http.StatusBadRequest, "user hasn't permissions to read projects")
|
||||
return
|
||||
}
|
||||
if err := issues_model.ChangeProjectAssign(issue, ctx.Doer, projectID); err != nil {
|
||||
if err := issues_model.ChangeProjectAssign(ctx, issue, ctx.Doer, projectID); err != nil {
|
||||
ctx.ServerError("ChangeProjectAssign", err)
|
||||
return
|
||||
}
|
||||
|
@ -1332,7 +1332,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
extIssueUnit, err := ctx.Repo.Repository.GetUnit(ctx, unit.TypeExternalTracker)
|
||||
if err == nil && extIssueUnit != nil {
|
||||
if extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == markup.IssueNameStyleNumeric || extIssueUnit.ExternalTrackerConfig().ExternalTrackerStyle == "" {
|
||||
metas := ctx.Repo.Repository.ComposeMetas()
|
||||
metas := ctx.Repo.Repository.ComposeMetas(ctx)
|
||||
metas["index"] = ctx.Params(":index")
|
||||
res, err := vars.Expand(extIssueUnit.ExternalTrackerConfig().ExternalTrackerFormat, metas)
|
||||
if err != nil {
|
||||
|
@ -1425,7 +1425,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
|
||||
issue.RenderedContent, err = markdown.RenderString(&markup.RenderContext{
|
||||
URLPrefix: ctx.Repo.RepoLink,
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(),
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(ctx),
|
||||
GitRepo: ctx.Repo.GitRepo,
|
||||
Ctx: ctx,
|
||||
}, issue.Content)
|
||||
|
@ -1588,7 +1588,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
|
||||
comment.RenderedContent, err = markdown.RenderString(&markup.RenderContext{
|
||||
URLPrefix: ctx.Repo.RepoLink,
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(),
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(ctx),
|
||||
GitRepo: ctx.Repo.GitRepo,
|
||||
Ctx: ctx,
|
||||
}, comment.Content)
|
||||
|
@ -1665,7 +1665,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
} else if comment.Type.HasContentSupport() {
|
||||
comment.RenderedContent, err = markdown.RenderString(&markup.RenderContext{
|
||||
URLPrefix: ctx.Repo.RepoLink,
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(),
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(ctx),
|
||||
GitRepo: ctx.Repo.GitRepo,
|
||||
Ctx: ctx,
|
||||
}, comment.Content)
|
||||
|
@ -1909,7 +1909,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
if pull.HasMerged || issue.IsClosed || !ctx.IsSigned {
|
||||
return false
|
||||
}
|
||||
if pull.CanAutoMerge() || pull.IsWorkInProgress() || pull.IsChecking() {
|
||||
if pull.CanAutoMerge() || pull.IsWorkInProgress(ctx) || pull.IsChecking() {
|
||||
return false
|
||||
}
|
||||
if (ctx.Doer.IsAdmin || ctx.Repo.IsAdmin()) && prConfig.AllowManualMerge {
|
||||
|
@ -2223,7 +2223,7 @@ func UpdateIssueContent(ctx *context.Context) {
|
|||
|
||||
content, err := markdown.RenderString(&markup.RenderContext{
|
||||
URLPrefix: ctx.FormString("context"), // FIXME: <- IS THIS SAFE ?
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(),
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(ctx),
|
||||
GitRepo: ctx.Repo.GitRepo,
|
||||
Ctx: ctx,
|
||||
}, issue.Content)
|
||||
|
@ -2286,7 +2286,7 @@ func UpdateIssueMilestone(ctx *context.Context) {
|
|||
continue
|
||||
}
|
||||
issue.MilestoneID = milestoneID
|
||||
if err := issue_service.ChangeMilestoneAssign(issue, ctx.Doer, oldMilestoneID); err != nil {
|
||||
if err := issue_service.ChangeMilestoneAssign(ctx, issue, ctx.Doer, oldMilestoneID); err != nil {
|
||||
ctx.ServerError("ChangeMilestoneAssign", err)
|
||||
return
|
||||
}
|
||||
|
@ -2536,7 +2536,7 @@ func SearchIssues(ctx *context.Context) {
|
|||
allPublic = true
|
||||
opts.AllPublic = false // set it false to avoid returning too many repos, we could filter by indexer
|
||||
}
|
||||
repoIDs, _, err = repo_model.SearchRepositoryIDs(opts)
|
||||
repoIDs, _, err = repo_model.SearchRepositoryIDs(ctx, opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "SearchRepositoryIDs", err.Error())
|
||||
return
|
||||
|
@ -3127,7 +3127,7 @@ func UpdateCommentContent(ctx *context.Context) {
|
|||
|
||||
content, err := markdown.RenderString(&markup.RenderContext{
|
||||
URLPrefix: ctx.FormString("context"), // FIXME: <- IS THIS SAFE ?
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(),
|
||||
Metas: ctx.Repo.Repository.ComposeMetas(ctx),
|
||||
GitRepo: ctx.Repo.GitRepo,
|
||||
Ctx: ctx,
|
||||
}, comment.Content)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue