diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-11-19 09:12:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-19 16:12:33 +0800 |
commit | 044c754ea53f5b81f451451df53aea366f6f700a (patch) | |
tree | 45688c28a84f87f71ec3f99eb0e8456eb7d19c42 /routers/web/repo | |
parent | fefdb7ffd11bbfbff66dae8e88681ec840dedfde (diff) | |
download | gitea-044c754ea53f5b81f451451df53aea366f6f700a.tar.gz gitea-044c754ea53f5b81f451451df53aea366f6f700a.zip |
Add `context.Context` to more methods (#21546)
This PR adds a context parameter to a bunch of methods. Some helper
`xxxCtx()` methods got replaced with the normal name now.
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'routers/web/repo')
-rw-r--r-- | routers/web/repo/branch.go | 8 | ||||
-rw-r--r-- | routers/web/repo/compare.go | 4 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 60 | ||||
-rw-r--r-- | routers/web/repo/issue_label.go | 2 | ||||
-rw-r--r-- | routers/web/repo/projects.go | 4 | ||||
-rw-r--r-- | routers/web/repo/pull.go | 30 | ||||
-rw-r--r-- | routers/web/repo/pull_review.go | 4 | ||||
-rw-r--r-- | routers/web/repo/release.go | 8 | ||||
-rw-r--r-- | routers/web/repo/repo.go | 2 | ||||
-rw-r--r-- | routers/web/repo/tag.go | 4 | ||||
-rw-r--r-- | routers/web/repo/wiki.go | 6 |
11 files changed, 66 insertions, 66 deletions
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go index d1f1255db4..a7588d275d 100644 --- a/routers/web/repo/branch.go +++ b/routers/web/repo/branch.go @@ -275,14 +275,14 @@ func loadOneBranch(ctx *context.Context, rawBranch, defaultBranch *git.Branch, p mergeMovedOn := false if pr != nil { pr.HeadRepo = ctx.Repo.Repository - if err := pr.LoadIssue(); err != nil { - ctx.ServerError("pr.LoadIssue", err) + if err := pr.LoadIssue(ctx); err != nil { + ctx.ServerError("LoadIssue", err) return nil } if repo, ok := repoIDToRepo[pr.BaseRepoID]; ok { pr.BaseRepo = repo - } else if err := pr.LoadBaseRepoCtx(ctx); err != nil { - ctx.ServerError("pr.LoadBaseRepo", err) + } else if err := pr.LoadBaseRepo(ctx); err != nil { + ctx.ServerError("LoadBaseRepo", err) return nil } else { repoIDToRepo[pr.BaseRepoID] = pr.BaseRepo diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index db6b59471f..0fb8e44725 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -747,7 +747,7 @@ func CompareDiff(ctx *context.Context) { ctx.Data["HeadTags"] = headTags if ctx.Data["PageIsComparePull"] == true { - pr, err := issues_model.GetUnmergedPullRequest(ci.HeadRepo.ID, ctx.Repo.Repository.ID, ci.HeadBranch, ci.BaseBranch, issues_model.PullRequestFlowGithub) + pr, err := issues_model.GetUnmergedPullRequest(ctx, ci.HeadRepo.ID, ctx.Repo.Repository.ID, ci.HeadBranch, ci.BaseBranch, issues_model.PullRequestFlowGithub) if err != nil { if !issues_model.IsErrPullRequestNotExist(err) { ctx.ServerError("GetUnmergedPullRequest", err) @@ -755,7 +755,7 @@ func CompareDiff(ctx *context.Context) { } } else { ctx.Data["HasPullRequest"] = true - if err := pr.LoadIssue(); err != nil { + if err := pr.LoadIssue(ctx); err != nil { ctx.ServerError("LoadIssue", err) return } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 38ad593c17..a62084fdca 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -246,7 +246,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti if forceEmpty { issues = []*issues_model.Issue{} } else { - issues, err = issues_model.Issues(&issues_model.IssuesOptions{ + issues, err = issues_model.Issues(ctx, &issues_model.IssuesOptions{ ListOptions: db.ListOptions{ Page: pager.Paginater.Current(), PageSize: setting.UI.IssuePagingNum, @@ -608,7 +608,7 @@ func RetrieveRepoReviewers(ctx *context.Context, repo *repo_model.Repository, is currentPullReviewers := make([]*repoReviewerSelection, 0, len(pullReviews)) for _, item := range pullReviews { if item.Review.ReviewerID > 0 { - if err = item.Review.LoadReviewer(); err != nil { + if err = item.Review.LoadReviewer(ctx); err != nil { if user_model.IsErrUserNotExist(err) { continue } @@ -617,7 +617,7 @@ func RetrieveRepoReviewers(ctx *context.Context, repo *repo_model.Repository, is } item.User = item.Review.Reviewer } else if item.Review.ReviewerTeamID > 0 { - if err = item.Review.LoadReviewerTeam(); err != nil { + if err = item.Review.LoadReviewerTeam(ctx); err != nil { if organization.IsErrTeamNotExist(err) { continue } @@ -1163,7 +1163,7 @@ func getBranchData(ctx *context.Context, issue *issues_model.Issue) { pull := issue.PullRequest ctx.Data["BaseBranch"] = pull.BaseBranch ctx.Data["HeadBranch"] = pull.HeadBranch - ctx.Data["HeadUserName"] = pull.MustHeadUserName() + ctx.Data["HeadUserName"] = pull.MustHeadUserName(ctx) } } @@ -1426,13 +1426,13 @@ func ViewIssue(ctx *context.Context) { for _, comment = range issue.Comments { comment.Issue = issue - if err := comment.LoadPoster(); err != nil { + if err := comment.LoadPoster(ctx); err != nil { ctx.ServerError("LoadPoster", err) return } if comment.Type == issues_model.CommentTypeComment || comment.Type == issues_model.CommentTypeReview { - if err := comment.LoadAttachments(); err != nil { + if err := comment.LoadAttachments(ctx); err != nil { ctx.ServerError("LoadAttachments", err) return } @@ -1467,7 +1467,7 @@ func ViewIssue(ctx *context.Context) { return } } else if comment.Type == issues_model.CommentTypeMilestone { - if err = comment.LoadMilestone(); err != nil { + if err = comment.LoadMilestone(ctx); err != nil { ctx.ServerError("LoadMilestone", err) return } @@ -1591,7 +1591,7 @@ func ViewIssue(ctx *context.Context) { ctx.Data["AllowMerge"] = false if ctx.IsSigned { - if err := pull.LoadHeadRepoCtx(ctx); err != nil { + if err := pull.LoadHeadRepo(ctx); err != nil { log.Error("LoadHeadRepo: %v", err) } else if pull.HeadRepo != nil { perm, err := access_model.GetUserRepoPermission(ctx, pull.HeadRepo, ctx.Doer) @@ -1613,7 +1613,7 @@ func ViewIssue(ctx *context.Context) { } } - if err := pull.LoadBaseRepoCtx(ctx); err != nil { + if err := pull.LoadBaseRepo(ctx); err != nil { log.Error("LoadBaseRepo: %v", err) } perm, err := access_model.GetUserRepoPermission(ctx, pull.BaseRepo, ctx.Doer) @@ -1662,14 +1662,14 @@ func ViewIssue(ctx *context.Context) { ctx.Data["MergeStyle"] = mergeStyle - defaultMergeMessage, err := pull_service.GetDefaultMergeMessage(ctx.Repo.GitRepo, pull, mergeStyle) + defaultMergeMessage, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, mergeStyle) if err != nil { ctx.ServerError("GetDefaultMergeMessage", err) return } ctx.Data["DefaultMergeMessage"] = defaultMergeMessage - defaultSquashMergeMessage, err := pull_service.GetDefaultMergeMessage(ctx.Repo.GitRepo, pull, repo_model.MergeStyleSquash) + defaultSquashMergeMessage, err := pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pull, repo_model.MergeStyleSquash) if err != nil { ctx.ServerError("GetDefaultSquashMergeMessage", err) return @@ -1885,7 +1885,7 @@ func GetIssueInfo(ctx *context.Context) { } } - ctx.JSON(http.StatusOK, convert.ToAPIIssue(issue)) + ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, issue)) } // UpdateIssueTitle change issue's title @@ -2280,7 +2280,7 @@ func SearchIssues(ctx *context.Context) { repoCond := repo_model.SearchRepositoryCondition(opts) repoIDs, _, err := repo_model.SearchRepositoryIDs(opts) if err != nil { - ctx.Error(http.StatusInternalServerError, "SearchRepositoryByName", err.Error()) + ctx.Error(http.StatusInternalServerError, "SearchRepositoryIDs", err.Error()) return } @@ -2369,7 +2369,7 @@ func SearchIssues(ctx *context.Context) { issuesOpt.ReviewRequestedID = ctxUserID } - if issues, err = issues_model.Issues(issuesOpt); err != nil { + if issues, err = issues_model.Issues(ctx, issuesOpt); err != nil { ctx.Error(http.StatusInternalServerError, "Issues", err.Error()) return } @@ -2377,14 +2377,14 @@ func SearchIssues(ctx *context.Context) { issuesOpt.ListOptions = db.ListOptions{ Page: -1, } - if filteredCount, err = issues_model.CountIssues(issuesOpt); err != nil { + if filteredCount, err = issues_model.CountIssues(ctx, issuesOpt); err != nil { ctx.Error(http.StatusInternalServerError, "CountIssues", err.Error()) return } } ctx.SetTotalCountHeader(filteredCount) - ctx.JSON(http.StatusOK, convert.ToAPIIssueList(issues)) + ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues)) } func getUserIDForFilter(ctx *context.Context, queryName string) int64 { @@ -2527,7 +2527,7 @@ func ListIssues(ctx *context.Context) { MentionedID: mentionedByID, } - if issues, err = issues_model.Issues(issuesOpt); err != nil { + if issues, err = issues_model.Issues(ctx, issuesOpt); err != nil { ctx.Error(http.StatusInternalServerError, err.Error()) return } @@ -2535,14 +2535,14 @@ func ListIssues(ctx *context.Context) { issuesOpt.ListOptions = db.ListOptions{ Page: -1, } - if filteredCount, err = issues_model.CountIssues(issuesOpt); err != nil { + if filteredCount, err = issues_model.CountIssues(ctx, issuesOpt); err != nil { ctx.Error(http.StatusInternalServerError, err.Error()) return } } ctx.SetTotalCountHeader(filteredCount) - ctx.JSON(http.StatusOK, convert.ToAPIIssueList(issues)) + ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues)) } // UpdateIssueStatus change issue's status @@ -2562,7 +2562,7 @@ func UpdateIssueStatus(ctx *context.Context) { log.Warn("Unrecognized action: %s", action) } - if _, err := issues_model.IssueList(issues).LoadRepositories(); err != nil { + if _, err := issues_model.IssueList(issues).LoadRepositories(ctx); err != nil { ctx.ServerError("LoadRepositories", err) return } @@ -2646,7 +2646,7 @@ func NewComment(ctx *context.Context) { if form.Status == "reopen" && issue.IsPull { pull := issue.PullRequest var err error - pr, err = issues_model.GetUnmergedPullRequest(pull.HeadRepoID, pull.BaseRepoID, pull.HeadBranch, pull.BaseBranch, pull.Flow) + pr, err = issues_model.GetUnmergedPullRequest(ctx, pull.HeadRepoID, pull.BaseRepoID, pull.HeadBranch, pull.BaseBranch, pull.Flow) if err != nil { if !issues_model.IsErrPullRequestNotExist(err) { ctx.ServerError("GetUnmergedPullRequest", err) @@ -2706,7 +2706,7 @@ func NewComment(ctx *context.Context) { return } - comment, err := comment_service.CreateIssueComment(ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments) + comment, err := comment_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Content, attachments) if err != nil { ctx.ServerError("CreateIssueComment", err) return @@ -2723,7 +2723,7 @@ func UpdateCommentContent(ctx *context.Context) { return } - if err := comment.LoadIssue(); err != nil { + if err := comment.LoadIssue(ctx); err != nil { ctx.NotFoundOrServerError("LoadIssue", issues_model.IsErrIssueNotExist, err) return } @@ -2746,12 +2746,12 @@ func UpdateCommentContent(ctx *context.Context) { }) return } - if err = comment_service.UpdateComment(comment, ctx.Doer, oldContent); err != nil { + if err = comment_service.UpdateComment(ctx, comment, ctx.Doer, oldContent); err != nil { ctx.ServerError("UpdateComment", err) return } - if err := comment.LoadAttachments(); err != nil { + if err := comment.LoadAttachments(ctx); err != nil { ctx.ServerError("LoadAttachments", err) return } @@ -2789,7 +2789,7 @@ func DeleteComment(ctx *context.Context) { return } - if err := comment.LoadIssue(); err != nil { + if err := comment.LoadIssue(ctx); err != nil { ctx.NotFoundOrServerError("LoadIssue", issues_model.IsErrIssueNotExist, err) return } @@ -2802,8 +2802,8 @@ func DeleteComment(ctx *context.Context) { return } - if err = comment_service.DeleteComment(ctx.Doer, comment); err != nil { - ctx.ServerError("DeleteCommentByID", err) + if err = comment_service.DeleteComment(ctx, ctx.Doer, comment); err != nil { + ctx.ServerError("DeleteComment", err) return } @@ -2915,7 +2915,7 @@ func ChangeCommentReaction(ctx *context.Context) { return } - if err := comment.LoadIssue(); err != nil { + if err := comment.LoadIssue(ctx); err != nil { ctx.NotFoundOrServerError("LoadIssue", issues_model.IsErrIssueNotExist, err) return } @@ -3061,7 +3061,7 @@ func GetCommentAttachments(ctx *context.Context) { } attachments := make([]*api.Attachment, 0) if comment.Type == issues_model.CommentTypeComment { - if err := comment.LoadAttachments(); err != nil { + if err := comment.LoadAttachments(ctx); err != nil { ctx.ServerError("LoadAttachments", err) return } diff --git a/routers/web/repo/issue_label.go b/routers/web/repo/issue_label.go index 7af415a8fa..560f25a0af 100644 --- a/routers/web/repo/issue_label.go +++ b/routers/web/repo/issue_label.go @@ -75,7 +75,7 @@ func RetrieveLabels(ctx *context.Context) { return } for _, l := range orgLabels { - l.CalOpenOrgIssues(ctx.Repo.Repository.ID, l.ID) + l.CalOpenOrgIssues(ctx, ctx.Repo.Repository.ID, l.ID) } ctx.Data["OrgLabels"] = orgLabels diff --git a/routers/web/repo/projects.go b/routers/web/repo/projects.go index f054ad6e54..fb2d25a22b 100644 --- a/routers/web/repo/projects.go +++ b/routers/web/repo/projects.go @@ -297,7 +297,7 @@ func ViewProject(ctx *context.Context) { boards[0].Title = ctx.Tr("repo.projects.type.uncategorized") } - issuesMap, err := issues_model.LoadIssuesFromBoardList(boards) + issuesMap, err := issues_model.LoadIssuesFromBoardList(ctx, boards) if err != nil { ctx.ServerError("LoadIssuesOfBoards", err) return @@ -314,7 +314,7 @@ func ViewProject(ctx *context.Context) { } if len(referencedIds) > 0 { - if linkedPrs, err := issues_model.Issues(&issues_model.IssuesOptions{ + if linkedPrs, err := issues_model.Issues(ctx, &issues_model.IssuesOptions{ IssueIDs: referencedIds, IsPull: util.OptionalBoolTrue, }); err == nil { diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 41eac7cc39..870bc1773b 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -281,7 +281,7 @@ func checkPullInfo(ctx *context.Context) *issues_model.Issue { } return nil } - if err = issue.LoadPoster(); err != nil { + if err = issue.LoadPoster(ctx); err != nil { ctx.ServerError("LoadPoster", err) return nil } @@ -297,12 +297,12 @@ func checkPullInfo(ctx *context.Context) *issues_model.Issue { return nil } - if err = issue.LoadPullRequest(); err != nil { + if err = issue.LoadPullRequest(ctx); err != nil { ctx.ServerError("LoadPullRequest", err) return nil } - if err = issue.PullRequest.LoadHeadRepoCtx(ctx); err != nil { + if err = issue.PullRequest.LoadHeadRepo(ctx); err != nil { ctx.ServerError("LoadHeadRepo", err) return nil } @@ -319,12 +319,12 @@ func checkPullInfo(ctx *context.Context) *issues_model.Issue { } func setMergeTarget(ctx *context.Context, pull *issues_model.PullRequest) { - if ctx.Repo.Owner.Name == pull.MustHeadUserName() { + if ctx.Repo.Owner.Name == pull.MustHeadUserName(ctx) { ctx.Data["HeadTarget"] = pull.HeadBranch } else if pull.HeadRepo == nil { - ctx.Data["HeadTarget"] = pull.MustHeadUserName() + ":" + pull.HeadBranch + ctx.Data["HeadTarget"] = pull.MustHeadUserName(ctx) + ":" + pull.HeadBranch } else { - ctx.Data["HeadTarget"] = pull.MustHeadUserName() + "/" + pull.HeadRepo.Name + ":" + pull.HeadBranch + ctx.Data["HeadTarget"] = pull.MustHeadUserName(ctx) + "/" + pull.HeadRepo.Name + ":" + pull.HeadBranch } ctx.Data["BaseTarget"] = pull.BaseBranch ctx.Data["HeadBranchHTMLURL"] = pull.GetHeadBranchHTMLURL() @@ -416,12 +416,12 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C repo := ctx.Repo.Repository pull := issue.PullRequest - if err := pull.LoadHeadRepoCtx(ctx); err != nil { + if err := pull.LoadHeadRepo(ctx); err != nil { ctx.ServerError("LoadHeadRepo", err) return nil } - if err := pull.LoadBaseRepoCtx(ctx); err != nil { + if err := pull.LoadBaseRepo(ctx); err != nil { ctx.ServerError("LoadBaseRepo", err) return nil } @@ -606,7 +606,7 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C if pull.IsWorkInProgress() { ctx.Data["IsPullWorkInProgress"] = true - ctx.Data["WorkInProgressPrefix"] = pull.GetWorkInProgressPrefix() + ctx.Data["WorkInProgressPrefix"] = pull.GetWorkInProgressPrefix(ctx) } if pull.IsFilesConflicted() { @@ -834,11 +834,11 @@ func UpdatePullRequest(ctx *context.Context) { rebase := ctx.FormString("style") == "rebase" - if err := issue.PullRequest.LoadBaseRepoCtx(ctx); err != nil { + if err := issue.PullRequest.LoadBaseRepo(ctx); err != nil { ctx.ServerError("LoadBaseRepo", err) return } - if err := issue.PullRequest.LoadHeadRepoCtx(ctx); err != nil { + if err := issue.PullRequest.LoadHeadRepo(ctx); err != nil { ctx.ServerError("LoadHeadRepo", err) return } @@ -974,7 +974,7 @@ func MergePullRequest(ctx *context.Context) { message := strings.TrimSpace(form.MergeTitleField) if len(message) == 0 { var err error - message, err = pull_service.GetDefaultMergeMessage(ctx.Repo.GitRepo, pr, repo_model.MergeStyle(form.Do)) + message, err = pull_service.GetDefaultMergeMessage(ctx, ctx.Repo.GitRepo, pr, repo_model.MergeStyle(form.Do)) if err != nil { ctx.ServerError("GetDefaultMergeMessage", err) return @@ -1296,14 +1296,14 @@ func CleanUpPullRequest(ctx *context.Context) { return } - if err := pr.LoadHeadRepoCtx(ctx); err != nil { + if err := pr.LoadHeadRepo(ctx); err != nil { ctx.ServerError("LoadHeadRepo", err) return } else if pr.HeadRepo == nil { // Forked repository has already been deleted ctx.NotFound("CleanUpPullRequest", nil) return - } else if err = pr.LoadBaseRepoCtx(ctx); err != nil { + } else if err = pr.LoadBaseRepo(ctx); err != nil { ctx.ServerError("LoadBaseRepo", err) return } else if err = pr.HeadRepo.GetOwner(ctx); err != nil { @@ -1499,7 +1499,7 @@ func UpdatePullRequestTarget(ctx *context.Context) { } return } - notification.NotifyPullRequestChangeTargetBranch(ctx.Doer, pr, targetBranch) + notification.NotifyPullRequestChangeTargetBranch(ctx, ctx.Doer, pr, targetBranch) ctx.JSON(http.StatusOK, map[string]interface{}{ "base_branch": pr.BaseBranch, diff --git a/routers/web/repo/pull_review.go b/routers/web/repo/pull_review.go index bc64f35472..bbaacc234c 100644 --- a/routers/web/repo/pull_review.go +++ b/routers/web/repo/pull_review.go @@ -114,7 +114,7 @@ func UpdateResolveConversation(ctx *context.Context) { return } - if err = comment.LoadIssue(); err != nil { + if err = comment.LoadIssue(ctx); err != nil { ctx.ServerError("comment.LoadIssue", err) return } @@ -169,7 +169,7 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment) { ctx.Data["comments"] = comments ctx.Data["CanMarkConversation"] = true ctx.Data["Issue"] = comment.Issue - if err = comment.Issue.LoadPullRequest(); err != nil { + if err = comment.Issue.LoadPullRequest(ctx); err != nil { ctx.ServerError("comment.Issue.LoadPullRequest", err) return } diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 0cb85f3798..0373d5b158 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -130,7 +130,7 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { opts.IncludeDrafts = writeAccess } - releases, err := repo_model.GetReleasesByRepoID(ctx.Repo.Repository.ID, opts) + releases, err := repo_model.GetReleasesByRepoID(ctx, ctx.Repo.Repository.ID, opts) if err != nil { ctx.ServerError("GetReleasesByRepoID", err) return @@ -266,7 +266,7 @@ func LatestRelease(ctx *context.Context) { return } - if err := release.LoadAttributes(); err != nil { + if err := release.LoadAttributes(ctx); err != nil { ctx.ServerError("LoadAttributes", err) return } @@ -289,7 +289,7 @@ func NewRelease(ctx *context.Context) { if rel != nil { rel.Repo = ctx.Repo.Repository - if err := rel.LoadAttributes(); err != nil { + if err := rel.LoadAttributes(ctx); err != nil { ctx.ServerError("LoadAttributes", err) return } @@ -454,7 +454,7 @@ func EditRelease(ctx *context.Context) { ctx.Data["IsDraft"] = rel.IsDraft rel.Repo = ctx.Repo.Repository - if err := rel.LoadAttributes(); err != nil { + if err := rel.LoadAttributes(ctx); err != nil { ctx.ServerError("LoadAttributes", err) return } diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index 3e746d3f05..7bcca1d02a 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -540,7 +540,7 @@ func SearchRepo(ctx *context.Context) { } var err error - repos, count, err := repo_model.SearchRepository(opts) + repos, count, err := repo_model.SearchRepository(ctx, opts) if err != nil { ctx.JSON(http.StatusInternalServerError, api.SearchError{ OK: false, diff --git a/routers/web/repo/tag.go b/routers/web/repo/tag.go index f63a50782b..4d46716c30 100644 --- a/routers/web/repo/tag.go +++ b/routers/web/repo/tag.go @@ -124,7 +124,7 @@ func DeleteProtectedTagPost(ctx *context.Context) { return } - if err := git_model.DeleteProtectedTag(pt); err != nil { + if err := git_model.DeleteProtectedTag(ctx, pt); err != nil { ctx.ServerError("DeleteProtectedTag", err) return } @@ -137,7 +137,7 @@ func setTagsContext(ctx *context.Context) error { ctx.Data["Title"] = ctx.Tr("repo.settings") ctx.Data["PageIsSettingsTags"] = true - protectedTags, err := git_model.GetProtectedTags(ctx.Repo.Repository.ID) + protectedTags, err := git_model.GetProtectedTags(ctx, ctx.Repo.Repository.ID) if err != nil { ctx.ServerError("GetProtectedTags", err) return err diff --git a/routers/web/repo/wiki.go b/routers/web/repo/wiki.go index a10e12ee63..24d851762b 100644 --- a/routers/web/repo/wiki.go +++ b/routers/web/repo/wiki.go @@ -706,7 +706,7 @@ func NewWikiPost(ctx *context.Context) { return } - notification.NotifyNewWikiPage(ctx.Doer, ctx.Repo.Repository, wikiName, form.Message) + notification.NotifyNewWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, wikiName, form.Message) ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + wiki_service.NameToSubURL(wikiName)) } @@ -750,7 +750,7 @@ func EditWikiPost(ctx *context.Context) { return } - notification.NotifyEditWikiPage(ctx.Doer, ctx.Repo.Repository, newWikiName, form.Message) + notification.NotifyEditWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, newWikiName, form.Message) ctx.Redirect(ctx.Repo.RepoLink + "/wiki/" + wiki_service.NameToSubURL(newWikiName)) } @@ -767,7 +767,7 @@ func DeleteWikiPagePost(ctx *context.Context) { return } - notification.NotifyDeleteWikiPage(ctx.Doer, ctx.Repo.Repository, wikiName) + notification.NotifyDeleteWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, wikiName) ctx.JSON(http.StatusOK, map[string]interface{}{ "redirect": ctx.Repo.RepoLink + "/wiki/", |