Rename almost all Ctx functions (#22071)
This commit is contained in:
parent
097d4e30b1
commit
68704532c2
78 changed files with 562 additions and 611 deletions
|
@ -174,13 +174,13 @@ func AddCollaborator(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := repo_module.AddCollaborator(ctx.Repo.Repository, collaborator); err != nil {
|
||||
if err := repo_module.AddCollaborator(ctx, ctx.Repo.Repository, collaborator); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "AddCollaborator", err)
|
||||
return
|
||||
}
|
||||
|
||||
if form.Permission != nil {
|
||||
if err := repo_model.ChangeCollaborationAccessMode(ctx.Repo.Repository, collaborator.ID, perm.ParseAccessMode(*form.Permission)); err != nil {
|
||||
if err := repo_model.ChangeCollaborationAccessMode(ctx, ctx.Repo.Repository, collaborator.ID, perm.ParseAccessMode(*form.Permission)); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "ChangeCollaborationAccessMode", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers/api/v1/utils"
|
||||
comment_service "code.gitea.io/gitea/services/comments"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
)
|
||||
|
||||
// ListIssueComments list all the comments of an issue
|
||||
|
@ -362,7 +362,7 @@ func CreateIssueComment(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
comment, err := comment_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Body, nil)
|
||||
comment, err := issue_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Body, nil)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "CreateIssueComment", err)
|
||||
return
|
||||
|
@ -556,7 +556,7 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
|
|||
|
||||
oldContent := comment.Content
|
||||
comment.Content = form.Body
|
||||
if err := comment_service.UpdateComment(ctx, comment, ctx.Doer, oldContent); err != nil {
|
||||
if err := issue_service.UpdateComment(ctx, comment, ctx.Doer, oldContent); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "UpdateComment", err)
|
||||
return
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ func deleteIssueComment(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
if err = comment_service.DeleteComment(ctx, ctx.Doer, comment); err != nil {
|
||||
if err = issue_service.DeleteComment(ctx, ctx.Doer, comment); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "DeleteCommentByID", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/attachment"
|
||||
comment_service "code.gitea.io/gitea/services/comments"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
)
|
||||
|
||||
// GetIssueCommentAttachment gets a single attachment of the comment
|
||||
|
@ -196,7 +196,7 @@ func CreateIssueCommentAttachment(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
|
||||
if err = comment_service.UpdateComment(ctx, comment, ctx.Doer, comment.Content); err != nil {
|
||||
if err = issue_service.UpdateComment(ctx, comment, ctx.Doer, comment.Content); err != nil {
|
||||
ctx.ServerError("UpdateComment", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
|
|||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.NotFound("Timetracker is disabled")
|
||||
return
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ func AddTime(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
if !ctx.Repo.CanUseTimetracker(issue, ctx.Doer) {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.Error(http.StatusBadRequest, "", "time tracking disabled")
|
||||
return
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ func ResetIssueTime(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
if !ctx.Repo.CanUseTimetracker(issue, ctx.Doer) {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.JSON(http.StatusBadRequest, struct{ Message string }{Message: "time tracking disabled"})
|
||||
return
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ func DeleteTime(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
if !ctx.Repo.CanUseTimetracker(issue, ctx.Doer) {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.JSON(http.StatusBadRequest, struct{ Message string }{Message: "time tracking disabled"})
|
||||
return
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
|
|||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.Error(http.StatusBadRequest, "", "time tracking disabled")
|
||||
return
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
|
|||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.Error(http.StatusBadRequest, "", "time tracking disabled")
|
||||
return
|
||||
}
|
||||
|
|
|
@ -731,7 +731,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
var units []repo_model.RepoUnit
|
||||
var deleteUnitTypes []unit_model.Type
|
||||
|
||||
currHasIssues := repo.UnitEnabledCtx(ctx, unit_model.TypeIssues)
|
||||
currHasIssues := repo.UnitEnabled(ctx, unit_model.TypeIssues)
|
||||
newHasIssues := currHasIssues
|
||||
if opts.HasIssues != nil {
|
||||
newHasIssues = *opts.HasIssues
|
||||
|
@ -771,7 +771,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
AllowOnlyContributorsToTrackTime: opts.InternalTracker.AllowOnlyContributorsToTrackTime,
|
||||
EnableDependencies: opts.InternalTracker.EnableIssueDependencies,
|
||||
}
|
||||
} else if unit, err := repo.GetUnit(unit_model.TypeIssues); err != nil {
|
||||
} else if unit, err := repo.GetUnit(ctx, unit_model.TypeIssues); err != nil {
|
||||
// Unit type doesn't exist so we make a new config file with default values
|
||||
config = &repo_model.IssuesConfig{
|
||||
EnableTimetracker: true,
|
||||
|
@ -798,7 +798,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
}
|
||||
}
|
||||
|
||||
currHasWiki := repo.UnitEnabledCtx(ctx, unit_model.TypeWiki)
|
||||
currHasWiki := repo.UnitEnabled(ctx, unit_model.TypeWiki)
|
||||
newHasWiki := currHasWiki
|
||||
if opts.HasWiki != nil {
|
||||
newHasWiki = *opts.HasWiki
|
||||
|
@ -838,7 +838,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
}
|
||||
}
|
||||
|
||||
currHasPullRequests := repo.UnitEnabledCtx(ctx, unit_model.TypePullRequests)
|
||||
currHasPullRequests := repo.UnitEnabled(ctx, unit_model.TypePullRequests)
|
||||
newHasPullRequests := currHasPullRequests
|
||||
if opts.HasPullRequests != nil {
|
||||
newHasPullRequests = *opts.HasPullRequests
|
||||
|
@ -848,7 +848,7 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||
// We do allow setting individual PR settings through the API, so
|
||||
// we get the config settings and then set them
|
||||
// if those settings were provided in the opts.
|
||||
unit, err := repo.GetUnit(unit_model.TypePullRequests)
|
||||
unit, err := repo.GetUnit(ctx, unit_model.TypePullRequests)
|
||||
var config *repo_model.PullRequestsConfig
|
||||
if err != nil {
|
||||
// Unit type doesn't exist so we make a new config file with default values
|
||||
|
|
|
@ -105,7 +105,7 @@ func Transfer(ctx *context.APIContext) {
|
|||
|
||||
oldFullname := ctx.Repo.Repository.FullName()
|
||||
|
||||
if err := repo_service.StartRepositoryTransfer(ctx.Doer, newOwner, ctx.Repo.Repository, teams); err != nil {
|
||||
if err := repo_service.StartRepositoryTransfer(ctx, ctx.Doer, newOwner, ctx.Repo.Repository, teams); err != nil {
|
||||
if models.IsErrRepoTransferInProgress(err) {
|
||||
ctx.Error(http.StatusConflict, "StartRepositoryTransfer", err)
|
||||
return
|
||||
|
@ -207,7 +207,7 @@ func RejectTransfer(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
func acceptOrRejectRepoTransfer(ctx *context.APIContext, accept bool) error {
|
||||
repoTransfer, err := models.GetPendingRepositoryTransfer(ctx.Repo.Repository)
|
||||
repoTransfer, err := models.GetPendingRepositoryTransfer(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
if models.IsErrNoPendingTransfer(err) {
|
||||
ctx.NotFound()
|
||||
|
@ -216,7 +216,7 @@ func acceptOrRejectRepoTransfer(ctx *context.APIContext, accept bool) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := repoTransfer.LoadAttributes(); err != nil {
|
||||
if err := repoTransfer.LoadAttributes(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ func acceptOrRejectRepoTransfer(ctx *context.APIContext, accept bool) error {
|
|||
}
|
||||
|
||||
if accept {
|
||||
return repo_service.TransferOwnership(repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams)
|
||||
return repo_service.TransferOwnership(ctx, repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams)
|
||||
}
|
||||
|
||||
return models.CancelRepositoryTransfer(ctx.Repo.Repository)
|
||||
|
|
|
@ -382,7 +382,7 @@ func ServCommand(ctx *context.PrivateContext) {
|
|||
|
||||
if results.IsWiki {
|
||||
// Ensure the wiki is enabled before we allow access to it
|
||||
if _, err := repo.GetUnit(unit.TypeWiki); err != nil {
|
||||
if _, err := repo.GetUnit(ctx, unit.TypeWiki); err != nil {
|
||||
if repo_model.IsErrUnitTypeNotExist(err) {
|
||||
ctx.JSON(http.StatusForbidden, private.ErrServCommand{
|
||||
Results: results,
|
||||
|
|
|
@ -177,7 +177,7 @@ func CherryPickPost(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(unit.TypePullRequests) {
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(ctx, unit.TypePullRequests) {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
|
||||
} else {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName))
|
||||
|
|
|
@ -577,7 +577,7 @@ func PrepareCompareDiff(
|
|||
if (headCommitID == ci.CompareInfo.MergeBase && !ci.DirectComparison) ||
|
||||
headCommitID == ci.CompareInfo.BaseCommitID {
|
||||
ctx.Data["IsNothingToCompare"] = true
|
||||
if unit, err := repo.GetUnit(unit.TypePullRequests); err == nil {
|
||||
if unit, err := repo.GetUnit(ctx, unit.TypePullRequests); err == nil {
|
||||
config := unit.PullRequestsConfig()
|
||||
|
||||
if !config.AutodetectManualMerge {
|
||||
|
|
|
@ -328,7 +328,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
|
|||
}
|
||||
}
|
||||
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(unit.TypePullRequests) {
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(ctx, unit.TypePullRequests) {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
|
||||
} else {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath))
|
||||
|
@ -514,7 +514,7 @@ func DeleteFilePost(ctx *context.Context) {
|
|||
}
|
||||
|
||||
ctx.Flash.Success(ctx.Tr("repo.editor.file_delete_success", ctx.Repo.TreePath))
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(unit.TypePullRequests) {
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(ctx, unit.TypePullRequests) {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
|
||||
} else {
|
||||
treePath := path.Dir(ctx.Repo.TreePath)
|
||||
|
@ -717,7 +717,7 @@ func UploadFilePost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(unit.TypePullRequests) {
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(ctx, unit.TypePullRequests) {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
|
||||
} else {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath))
|
||||
|
|
|
@ -258,7 +258,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
|
|||
|
||||
if isWiki {
|
||||
// Ensure the wiki is enabled before we allow access to it
|
||||
if _, err := repo.GetUnit(unit.TypeWiki); err != nil {
|
||||
if _, err := repo.GetUnit(ctx, unit.TypeWiki); err != nil {
|
||||
if repo_model.IsErrUnitTypeNotExist(err) {
|
||||
ctx.PlainText(http.StatusForbidden, "repository wiki is disabled")
|
||||
return
|
||||
|
|
|
@ -47,7 +47,6 @@ import (
|
|||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
asymkey_service "code.gitea.io/gitea/services/asymkey"
|
||||
comment_service "code.gitea.io/gitea/services/comments"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
|
@ -114,7 +113,7 @@ func MustEnableIssues(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
unit, err := ctx.Repo.Repository.GetUnit(unit.TypeExternalTracker)
|
||||
unit, err := ctx.Repo.Repository.GetUnit(ctx, unit.TypeExternalTracker)
|
||||
if err == nil {
|
||||
ctx.Redirect(unit.ExternalTrackerConfig().ExternalTrackerURL)
|
||||
return
|
||||
|
@ -1174,7 +1173,7 @@ func getBranchData(ctx *context.Context, issue *issues_model.Issue) {
|
|||
func ViewIssue(ctx *context.Context) {
|
||||
if ctx.Params(":type") == "issues" {
|
||||
// If issue was requested we check if repo has external tracker and redirect
|
||||
extIssueUnit, err := ctx.Repo.Repository.GetUnit(unit.TypeExternalTracker)
|
||||
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()
|
||||
|
@ -1375,7 +1374,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
comment *issues_model.Comment
|
||||
participants = make([]*user_model.User, 1, 10)
|
||||
)
|
||||
if ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
if ctx.IsSigned {
|
||||
// Deal with the stopwatch
|
||||
ctx.Data["IsStopwatchRunning"] = issues_model.StopwatchExists(ctx.Doer.ID, issue.ID)
|
||||
|
@ -1636,7 +1635,7 @@ func ViewIssue(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
prUnit, err := repo.GetUnit(unit.TypePullRequests)
|
||||
prUnit, err := repo.GetUnit(ctx, unit.TypePullRequests)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetUnit", err)
|
||||
return
|
||||
|
@ -2709,7 +2708,7 @@ func NewComment(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
comment, err := comment_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments)
|
||||
comment, err := issue_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments)
|
||||
if err != nil {
|
||||
ctx.ServerError("CreateIssueComment", err)
|
||||
return
|
||||
|
@ -2749,8 +2748,7 @@ func UpdateCommentContent(ctx *context.Context) {
|
|||
})
|
||||
return
|
||||
}
|
||||
|
||||
if err = comment_service.UpdateComment(ctx, comment, ctx.Doer, oldContent); err != nil {
|
||||
if err = issue_service.UpdateComment(ctx, comment, ctx.Doer, oldContent); err != nil {
|
||||
ctx.ServerError("UpdateComment", err)
|
||||
return
|
||||
}
|
||||
|
@ -2806,7 +2804,7 @@ func DeleteComment(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err = comment_service.DeleteComment(ctx, ctx.Doer, comment); err != nil {
|
||||
if err = issue_service.DeleteComment(ctx, ctx.Doer, comment); err != nil {
|
||||
ctx.ServerError("DeleteComment", err)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ func Milestones(ctx *context.Context) {
|
|||
ctx.ServerError("GetMilestones", err)
|
||||
return
|
||||
}
|
||||
if ctx.Repo.Repository.IsTimetrackerEnabled() {
|
||||
if ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
if err := miles.LoadTotalTrackedTimes(); err != nil {
|
||||
ctx.ServerError("LoadTotalTrackedTimes", err)
|
||||
return
|
||||
|
|
|
@ -108,7 +108,7 @@ func NewDiffPatchPost(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(unit.TypePullRequests) {
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch && ctx.Repo.Repository.UnitEnabled(ctx, unit.TypePullRequests) {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/compare/" + util.PathEscapeSegments(ctx.Repo.BranchName) + "..." + util.PathEscapeSegments(form.NewBranchName))
|
||||
} else {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/src/branch/" + util.PathEscapeSegments(branchName) + "/" + util.PathEscapeSegments(form.TreePath))
|
||||
|
|
|
@ -196,7 +196,7 @@ func DeleteProject(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := project_model.DeleteProjectByID(p.ID); err != nil {
|
||||
if err := project_model.DeleteProjectByID(ctx, p.ID); err != nil {
|
||||
ctx.Flash.Error("DeleteProjectByID: " + err.Error())
|
||||
} else {
|
||||
ctx.Flash.Success(ctx.Tr("repo.projects.deletion_success"))
|
||||
|
|
|
@ -135,7 +135,7 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
|
|||
return
|
||||
}
|
||||
|
||||
count, err := repo_model.GetReleaseCountByRepoID(ctx.Repo.Repository.ID, opts)
|
||||
count, err := repo_model.GetReleaseCountByRepoID(ctx, ctx.Repo.Repository.ID, opts)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetReleaseCountByRepoID", err)
|
||||
return
|
||||
|
|
|
@ -314,12 +314,12 @@ func Action(ctx *context.Context) {
|
|||
}
|
||||
|
||||
func acceptOrRejectRepoTransfer(ctx *context.Context, accept bool) error {
|
||||
repoTransfer, err := models.GetPendingRepositoryTransfer(ctx.Repo.Repository)
|
||||
repoTransfer, err := models.GetPendingRepositoryTransfer(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := repoTransfer.LoadAttributes(); err != nil {
|
||||
if err := repoTransfer.LoadAttributes(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ func acceptOrRejectRepoTransfer(ctx *context.Context, accept bool) error {
|
|||
ctx.Repo.GitRepo = nil
|
||||
}
|
||||
|
||||
if err := repo_service.TransferOwnership(repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams); err != nil {
|
||||
if err := repo_service.TransferOwnership(ctx, repoTransfer.Doer, repoTransfer.Recipient, ctx.Repo.Repository, repoTransfer.Teams); err != nil {
|
||||
return err
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.transfer.success"))
|
||||
|
|
|
@ -689,7 +689,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
ctx.Repo.GitRepo = nil
|
||||
}
|
||||
|
||||
if err := repo_service.StartRepositoryTransfer(ctx.Doer, newOwner, repo, nil); err != nil {
|
||||
if err := repo_service.StartRepositoryTransfer(ctx, ctx.Doer, newOwner, repo, nil); err != nil {
|
||||
if repo_model.IsErrRepoAlreadyExist(err) {
|
||||
ctx.RenderWithErr(ctx.Tr("repo.settings.new_owner_has_same_repo"), tplSettingsOptions, nil)
|
||||
} else if models.IsErrRepoTransferInProgress(err) {
|
||||
|
@ -711,7 +711,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
repoTransfer, err := models.GetPendingRepositoryTransfer(ctx.Repo.Repository)
|
||||
repoTransfer, err := models.GetPendingRepositoryTransfer(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
if models.IsErrNoPendingTransfer(err) {
|
||||
ctx.Flash.Error("repo.settings.transfer_abort_invalid")
|
||||
|
@ -723,7 +723,7 @@ func SettingsPost(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if err := repoTransfer.LoadAttributes(); err != nil {
|
||||
if err := repoTransfer.LoadAttributes(ctx); err != nil {
|
||||
ctx.ServerError("LoadRecipient", err)
|
||||
return
|
||||
}
|
||||
|
@ -929,7 +929,7 @@ func CollaborationPost(ctx *context.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
if err = repo_module.AddCollaborator(ctx.Repo.Repository, u); err != nil {
|
||||
if err = repo_module.AddCollaborator(ctx, ctx.Repo.Repository, u); err != nil {
|
||||
ctx.ServerError("AddCollaborator", err)
|
||||
return
|
||||
}
|
||||
|
@ -945,6 +945,7 @@ func CollaborationPost(ctx *context.Context) {
|
|||
// ChangeCollaborationAccessMode response for changing access of a collaboration
|
||||
func ChangeCollaborationAccessMode(ctx *context.Context) {
|
||||
if err := repo_model.ChangeCollaborationAccessMode(
|
||||
ctx,
|
||||
ctx.Repo.Repository,
|
||||
ctx.FormInt64("uid"),
|
||||
perm.AccessMode(ctx.FormInt("mode"))); err != nil {
|
||||
|
|
|
@ -59,7 +59,7 @@ func MustEnableWiki(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
unit, err := ctx.Repo.Repository.GetUnit(unit.TypeExternalWiki)
|
||||
unit, err := ctx.Repo.Repository.GetUnit(ctx, unit.TypeExternalWiki)
|
||||
if err == nil {
|
||||
ctx.Redirect(unit.ExternalWikiConfig().ExternalWikiURL)
|
||||
return
|
||||
|
|
|
@ -231,7 +231,7 @@ func Milestones(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if milestones[i].Repo.IsTimetrackerEnabled() {
|
||||
if milestones[i].Repo.IsTimetrackerEnabled(ctx) {
|
||||
err := milestones[i].LoadTotalTrackedTime()
|
||||
if err != nil {
|
||||
ctx.ServerError("LoadTotalTrackedTime", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue