summaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2022-11-19 09:12:33 +0100
committerGitHub <noreply@github.com>2022-11-19 16:12:33 +0800
commit044c754ea53f5b81f451451df53aea366f6f700a (patch)
tree45688c28a84f87f71ec3f99eb0e8456eb7d19c42 /routers/api/v1
parentfefdb7ffd11bbfbff66dae8e88681ec840dedfde (diff)
downloadgitea-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/api/v1')
-rw-r--r--routers/api/v1/misc/nodeinfo.go2
-rw-r--r--routers/api/v1/notify/repo.go8
-rw-r--r--routers/api/v1/notify/threads.go8
-rw-r--r--routers/api/v1/notify/user.go8
-rw-r--r--routers/api/v1/org/team.go8
-rw-r--r--routers/api/v1/repo/branch.go12
-rw-r--r--routers/api/v1/repo/fork.go2
-rw-r--r--routers/api/v1/repo/issue.go28
-rw-r--r--routers/api/v1/repo/issue_comment.go24
-rw-r--r--routers/api/v1/repo/issue_reaction.go4
-rw-r--r--routers/api/v1/repo/issue_tracked_time.go10
-rw-r--r--routers/api/v1/repo/migrate.go2
-rw-r--r--routers/api/v1/repo/pull.go52
-rw-r--r--routers/api/v1/repo/pull_review.go4
-rw-r--r--routers/api/v1/repo/release.go8
-rw-r--r--routers/api/v1/repo/release_attachment.go2
-rw-r--r--routers/api/v1/repo/release_tags.go2
-rw-r--r--routers/api/v1/repo/repo.go4
-rw-r--r--routers/api/v1/repo/wiki.go6
-rw-r--r--routers/api/v1/user/repo.go6
-rw-r--r--routers/api/v1/user/star.go11
-rw-r--r--routers/api/v1/user/watch.go11
22 files changed, 112 insertions, 110 deletions
diff --git a/routers/api/v1/misc/nodeinfo.go b/routers/api/v1/misc/nodeinfo.go
index bd629b87ca..a4ba440356 100644
--- a/routers/api/v1/misc/nodeinfo.go
+++ b/routers/api/v1/misc/nodeinfo.go
@@ -42,7 +42,7 @@ func NodeInfo(ctx *context.APIContext) {
usersActiveMonth := int(user_model.CountUsers(&user_model.CountUserFilter{LastLoginSince: &timeOneMonthAgo}))
usersActiveHalfyear := int(user_model.CountUsers(&user_model.CountUserFilter{LastLoginSince: &timeHaveYearAgo}))
- allIssues, _ := issues_model.CountIssues(&issues_model.IssuesOptions{})
+ allIssues, _ := issues_model.CountIssues(ctx, &issues_model.IssuesOptions{})
allComments, _ := issues_model.CountComments(&issues_model.FindCommentsOptions{})
nodeInfoUsage = structs.NodeInfoUsage{
diff --git a/routers/api/v1/notify/repo.go b/routers/api/v1/notify/repo.go
index f8e1fb0865..6d9664400a 100644
--- a/routers/api/v1/notify/repo.go
+++ b/routers/api/v1/notify/repo.go
@@ -109,7 +109,7 @@ func ListRepoNotifications(ctx *context.APIContext) {
}
opts.RepoID = ctx.Repo.Repository.ID
- totalCount, err := activities_model.CountNotifications(opts)
+ totalCount, err := activities_model.CountNotifications(ctx, opts)
if err != nil {
ctx.InternalServerError(err)
return
@@ -120,7 +120,7 @@ func ListRepoNotifications(ctx *context.APIContext) {
ctx.InternalServerError(err)
return
}
- err = nl.LoadAttributes()
+ err = nl.LoadAttributes(ctx)
if err != nil {
ctx.InternalServerError(err)
return
@@ -217,12 +217,12 @@ func ReadRepoNotifications(ctx *context.APIContext) {
changed := make([]*structs.NotificationThread, 0, len(nl))
for _, n := range nl {
- notif, err := activities_model.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
+ notif, err := activities_model.SetNotificationStatus(ctx, n.ID, ctx.Doer, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
}
- _ = notif.LoadAttributes()
+ _ = notif.LoadAttributes(ctx)
changed = append(changed, convert.ToNotificationThread(notif))
}
ctx.JSON(http.StatusResetContent, changed)
diff --git a/routers/api/v1/notify/threads.go b/routers/api/v1/notify/threads.go
index 44a1d30a55..f8e4960912 100644
--- a/routers/api/v1/notify/threads.go
+++ b/routers/api/v1/notify/threads.go
@@ -42,7 +42,7 @@ func GetThread(ctx *context.APIContext) {
if n == nil {
return
}
- if err := n.LoadAttributes(); err != nil && !issues_model.IsErrCommentNotExist(err) {
+ if err := n.LoadAttributes(ctx); err != nil && !issues_model.IsErrCommentNotExist(err) {
ctx.InternalServerError(err)
return
}
@@ -89,12 +89,12 @@ func ReadThread(ctx *context.APIContext) {
targetStatus = activities_model.NotificationStatusRead
}
- notif, err := activities_model.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
+ notif, err := activities_model.SetNotificationStatus(ctx, n.ID, ctx.Doer, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
}
- if err = notif.LoadAttributes(); err != nil && !issues_model.IsErrCommentNotExist(err) {
+ if err = notif.LoadAttributes(ctx); err != nil && !issues_model.IsErrCommentNotExist(err) {
ctx.InternalServerError(err)
return
}
@@ -102,7 +102,7 @@ func ReadThread(ctx *context.APIContext) {
}
func getThread(ctx *context.APIContext) *activities_model.Notification {
- n, err := activities_model.GetNotificationByID(ctx.ParamsInt64(":id"))
+ n, err := activities_model.GetNotificationByID(ctx, ctx.ParamsInt64(":id"))
if err != nil {
if db.IsErrNotExist(err) {
ctx.Error(http.StatusNotFound, "GetNotificationByID", err)
diff --git a/routers/api/v1/notify/user.go b/routers/api/v1/notify/user.go
index 1b6706e16f..5f4d8b35c2 100644
--- a/routers/api/v1/notify/user.go
+++ b/routers/api/v1/notify/user.go
@@ -69,7 +69,7 @@ func ListNotifications(ctx *context.APIContext) {
return
}
- totalCount, err := activities_model.CountNotifications(opts)
+ totalCount, err := activities_model.CountNotifications(ctx, opts)
if err != nil {
ctx.InternalServerError(err)
return
@@ -80,7 +80,7 @@ func ListNotifications(ctx *context.APIContext) {
ctx.InternalServerError(err)
return
}
- err = nl.LoadAttributes()
+ err = nl.LoadAttributes(ctx)
if err != nil {
ctx.InternalServerError(err)
return
@@ -162,12 +162,12 @@ func ReadNotifications(ctx *context.APIContext) {
changed := make([]*structs.NotificationThread, 0, len(nl))
for _, n := range nl {
- notif, err := activities_model.SetNotificationStatus(n.ID, ctx.Doer, targetStatus)
+ notif, err := activities_model.SetNotificationStatus(ctx, n.ID, ctx.Doer, targetStatus)
if err != nil {
ctx.InternalServerError(err)
return
}
- _ = notif.LoadAttributes()
+ _ = notif.LoadAttributes(ctx)
changed = append(changed, convert.ToNotificationThread(notif))
}
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index f3e7834a49..b2bcc4d586 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -542,7 +542,7 @@ func GetTeamRepos(ctx *context.APIContext) {
}
repos := make([]*api.Repository, len(teamRepos))
for i, repo := range teamRepos {
- access, err := access_model.AccessLevel(ctx.Doer, repo)
+ access, err := access_model.AccessLevel(ctx, ctx.Doer, repo)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetTeamRepos", err)
return
@@ -593,7 +593,7 @@ func GetTeamRepo(ctx *context.APIContext) {
return
}
- access, err := access_model.AccessLevel(ctx.Doer, repo)
+ access, err := access_model.AccessLevel(ctx, ctx.Doer, repo)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetTeamRepos", err)
return
@@ -650,7 +650,7 @@ func AddTeamRepository(ctx *context.APIContext) {
if ctx.Written() {
return
}
- if access, err := access_model.AccessLevel(ctx.Doer, repo); err != nil {
+ if access, err := access_model.AccessLevel(ctx, ctx.Doer, repo); err != nil {
ctx.Error(http.StatusInternalServerError, "AccessLevel", err)
return
} else if access < perm.AccessModeAdmin {
@@ -700,7 +700,7 @@ func RemoveTeamRepository(ctx *context.APIContext) {
if ctx.Written() {
return
}
- if access, err := access_model.AccessLevel(ctx.Doer, repo); err != nil {
+ if access, err := access_model.AccessLevel(ctx, ctx.Doer, repo); err != nil {
ctx.Error(http.StatusInternalServerError, "AccessLevel", err)
return
} else if access < perm.AccessModeAdmin {
diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go
index 84a172e92b..d10a308df3 100644
--- a/routers/api/v1/repo/branch.go
+++ b/routers/api/v1/repo/branch.go
@@ -427,7 +427,7 @@ func CreateBranchProtection(ctx *context.APIContext) {
requiredApprovals = form.RequiredApprovals
}
- whitelistUsers, err := user_model.GetUserIDsByNames(form.PushWhitelistUsernames, false)
+ whitelistUsers, err := user_model.GetUserIDsByNames(ctx, form.PushWhitelistUsernames, false)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "User does not exist", err)
@@ -436,7 +436,7 @@ func CreateBranchProtection(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetUserIDsByNames", err)
return
}
- mergeWhitelistUsers, err := user_model.GetUserIDsByNames(form.MergeWhitelistUsernames, false)
+ mergeWhitelistUsers, err := user_model.GetUserIDsByNames(ctx, form.MergeWhitelistUsernames, false)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "User does not exist", err)
@@ -445,7 +445,7 @@ func CreateBranchProtection(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetUserIDsByNames", err)
return
}
- approvalsWhitelistUsers, err := user_model.GetUserIDsByNames(form.ApprovalsWhitelistUsernames, false)
+ approvalsWhitelistUsers, err := user_model.GetUserIDsByNames(ctx, form.ApprovalsWhitelistUsernames, false)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "User does not exist", err)
@@ -656,7 +656,7 @@ func EditBranchProtection(ctx *context.APIContext) {
var whitelistUsers []int64
if form.PushWhitelistUsernames != nil {
- whitelistUsers, err = user_model.GetUserIDsByNames(form.PushWhitelistUsernames, false)
+ whitelistUsers, err = user_model.GetUserIDsByNames(ctx, form.PushWhitelistUsernames, false)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "User does not exist", err)
@@ -670,7 +670,7 @@ func EditBranchProtection(ctx *context.APIContext) {
}
var mergeWhitelistUsers []int64
if form.MergeWhitelistUsernames != nil {
- mergeWhitelistUsers, err = user_model.GetUserIDsByNames(form.MergeWhitelistUsernames, false)
+ mergeWhitelistUsers, err = user_model.GetUserIDsByNames(ctx, form.MergeWhitelistUsernames, false)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "User does not exist", err)
@@ -684,7 +684,7 @@ func EditBranchProtection(ctx *context.APIContext) {
}
var approvalsWhitelistUsers []int64
if form.ApprovalsWhitelistUsernames != nil {
- approvalsWhitelistUsers, err = user_model.GetUserIDsByNames(form.ApprovalsWhitelistUsernames, false)
+ approvalsWhitelistUsers, err = user_model.GetUserIDsByNames(ctx, form.ApprovalsWhitelistUsernames, false)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "User does not exist", err)
diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go
index 112a9562f0..c0a79d1a63 100644
--- a/routers/api/v1/repo/fork.go
+++ b/routers/api/v1/repo/fork.go
@@ -59,7 +59,7 @@ func ListForks(ctx *context.APIContext) {
}
apiForks := make([]*api.Repository, len(forks))
for i, fork := range forks {
- access, err := access_model.AccessLevel(ctx.Doer, fork)
+ access, err := access_model.AccessLevel(ctx, ctx.Doer, fork)
if err != nil {
ctx.Error(http.StatusInternalServerError, "AccessLevel", err)
return
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 08e3e03741..60f9859e10 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -179,7 +179,7 @@ func SearchIssues(ctx *context.APIContext) {
repoCond := repo_model.SearchRepositoryCondition(opts)
repoIDs, _, err := repo_model.SearchRepositoryIDs(opts)
if err != nil {
- ctx.Error(http.StatusInternalServerError, "SearchRepositoryByName", err)
+ ctx.Error(http.StatusInternalServerError, "SearchRepositoryIDs", err)
return
}
@@ -268,7 +268,7 @@ func SearchIssues(ctx *context.APIContext) {
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)
return
}
@@ -276,7 +276,7 @@ func SearchIssues(ctx *context.APIContext) {
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)
return
}
@@ -284,7 +284,7 @@ func SearchIssues(ctx *context.APIContext) {
ctx.SetLinkHeader(int(filteredCount), limit)
ctx.SetTotalCountHeader(filteredCount)
- ctx.JSON(http.StatusOK, convert.ToAPIIssueList(issues))
+ ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
}
// ListIssues list the issues of a repository
@@ -477,7 +477,7 @@ func ListIssues(ctx *context.APIContext) {
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, "Issues", err)
return
}
@@ -485,7 +485,7 @@ func ListIssues(ctx *context.APIContext) {
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)
return
}
@@ -493,7 +493,7 @@ func ListIssues(ctx *context.APIContext) {
ctx.SetLinkHeader(int(filteredCount), listOptions.PageSize)
ctx.SetTotalCountHeader(filteredCount)
- ctx.JSON(http.StatusOK, convert.ToAPIIssueList(issues))
+ ctx.JSON(http.StatusOK, convert.ToAPIIssueList(ctx, issues))
}
func getUserIDForFilter(ctx *context.APIContext, queryName string) int64 {
@@ -555,7 +555,7 @@ func GetIssue(ctx *context.APIContext) {
}
return
}
- ctx.JSON(http.StatusOK, convert.ToAPIIssue(issue))
+ ctx.JSON(http.StatusOK, convert.ToAPIIssue(ctx, issue))
}
// CreateIssue create an issue of a repository
@@ -612,7 +612,7 @@ func CreateIssue(ctx *context.APIContext) {
var err error
if ctx.Repo.CanWrite(unit.TypeIssues) {
issue.MilestoneID = form.Milestone
- assigneeIDs, err = issues_model.MakeIDsFromAPIAssigneesToAdd(form.Assignee, form.Assignees)
+ assigneeIDs, err = issues_model.MakeIDsFromAPIAssigneesToAdd(ctx, form.Assignee, form.Assignees)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "", fmt.Sprintf("Assignee does not exist: [name: %s]", err))
@@ -671,7 +671,7 @@ func CreateIssue(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetIssueByID", err)
return
}
- ctx.JSON(http.StatusCreated, convert.ToAPIIssue(issue))
+ ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, issue))
}
// EditIssue modify an issue of a repository
@@ -823,11 +823,11 @@ func EditIssue(ctx *context.APIContext) {
}
if titleChanged {
- notification.NotifyIssueChangeTitle(ctx.Doer, issue, oldTitle)
+ notification.NotifyIssueChangeTitle(ctx, ctx.Doer, issue, oldTitle)
}
if statusChangeComment != nil {
- notification.NotifyIssueChangeStatus(ctx.Doer, issue, statusChangeComment, issue.IsClosed)
+ notification.NotifyIssueChangeStatus(ctx, ctx.Doer, issue, statusChangeComment, issue.IsClosed)
}
// Refetch from database to assign some automatic values
@@ -836,11 +836,11 @@ func EditIssue(ctx *context.APIContext) {
ctx.InternalServerError(err)
return
}
- if err = issue.LoadMilestone(); err != nil {
+ if err = issue.LoadMilestone(ctx); err != nil {
ctx.InternalServerError(err)
return
}
- ctx.JSON(http.StatusCreated, convert.ToAPIIssue(issue))
+ ctx.JSON(http.StatusCreated, convert.ToAPIIssue(ctx, issue))
}
func DeleteIssue(ctx *context.APIContext) {
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index 89038e4f16..a5da091727 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -91,7 +91,7 @@ func ListIssueComments(ctx *context.APIContext) {
return
}
- if err := issues_model.CommentList(comments).LoadPosters(); err != nil {
+ if err := issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
@@ -178,7 +178,7 @@ func ListIssueCommentsAndTimeline(ctx *context.APIContext) {
return
}
- if err := issues_model.CommentList(comments).LoadPosters(); err != nil {
+ if err := issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
@@ -187,7 +187,7 @@ func ListIssueCommentsAndTimeline(ctx *context.APIContext) {
for _, comment := range comments {
if comment.Type != issues_model.CommentTypeCode && isXRefCommentAccessible(ctx, ctx.Doer, comment, issue.RepoID) {
comment.Issue = issue
- apiComments = append(apiComments, convert.ToTimelineComment(comment, ctx.Doer))
+ apiComments = append(apiComments, convert.ToTimelineComment(ctx, comment, ctx.Doer))
}
}
@@ -281,21 +281,21 @@ func ListRepoIssueComments(ctx *context.APIContext) {
return
}
- if err = issues_model.CommentList(comments).LoadPosters(); err != nil {
+ if err = issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
apiComments := make([]*api.Comment, len(comments))
- if err := issues_model.CommentList(comments).LoadIssues(); err != nil {
+ if err := issues_model.CommentList(comments).LoadIssues(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssues", err)
return
}
- if err := issues_model.CommentList(comments).LoadPosters(); err != nil {
+ if err := issues_model.CommentList(comments).LoadPosters(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPosters", err)
return
}
- if _, err := issues_model.CommentList(comments).Issues().LoadRepositories(); err != nil {
+ if _, err := issues_model.CommentList(comments).Issues().LoadRepositories(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadRepositories", err)
return
}
@@ -354,7 +354,7 @@ func CreateIssueComment(ctx *context.APIContext) {
return
}
- comment, err := comment_service.CreateIssueComment(ctx.Doer, ctx.Repo.Repository, issue, form.Body, nil)
+ comment, err := comment_service.CreateIssueComment(ctx, ctx.Doer, ctx.Repo.Repository, issue, form.Body, nil)
if err != nil {
ctx.Error(http.StatusInternalServerError, "CreateIssueComment", err)
return
@@ -409,7 +409,7 @@ func GetIssueComment(ctx *context.APIContext) {
return
}
- if err = comment.LoadIssue(); err != nil {
+ if err = comment.LoadIssue(ctx); err != nil {
ctx.InternalServerError(err)
return
}
@@ -423,7 +423,7 @@ func GetIssueComment(ctx *context.APIContext) {
return
}
- if err := comment.LoadPoster(); err != nil {
+ if err := comment.LoadPoster(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "comment.LoadPoster", err)
return
}
@@ -548,7 +548,7 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
oldContent := comment.Content
comment.Content = form.Body
- if err := comment_service.UpdateComment(comment, ctx.Doer, oldContent); err != nil {
+ if err := comment_service.UpdateComment(ctx, comment, ctx.Doer, oldContent); err != nil {
ctx.Error(http.StatusInternalServerError, "UpdateComment", err)
return
}
@@ -647,7 +647,7 @@ func deleteIssueComment(ctx *context.APIContext) {
return
}
- if err = comment_service.DeleteComment(ctx.Doer, comment); err != nil {
+ if err = comment_service.DeleteComment(ctx, ctx.Doer, comment); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteCommentByID", err)
return
}
diff --git a/routers/api/v1/repo/issue_reaction.go b/routers/api/v1/repo/issue_reaction.go
index f4c40d2bcd..fb7fd713b3 100644
--- a/routers/api/v1/repo/issue_reaction.go
+++ b/routers/api/v1/repo/issue_reaction.go
@@ -58,7 +58,7 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
return
}
- if err := comment.LoadIssue(); err != nil {
+ if err := comment.LoadIssue(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "comment.LoadIssue", err)
}
@@ -185,7 +185,7 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp
return
}
- err = comment.LoadIssue()
+ err = comment.LoadIssue(ctx)
if err != nil {
ctx.Error(http.StatusInternalServerError, "comment.LoadIssue() failed", err)
}
diff --git a/routers/api/v1/repo/issue_tracked_time.go b/routers/api/v1/repo/issue_tracked_time.go
index 1e26403ec8..e3abb973be 100644
--- a/routers/api/v1/repo/issue_tracked_time.go
+++ b/routers/api/v1/repo/issue_tracked_time.go
@@ -139,7 +139,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
}
ctx.SetTotalCountHeader(count)
- ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
+ ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}
// AddTime add time manual to the given issue
@@ -224,7 +224,7 @@ func AddTime(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToTrackedTime(trackedTime))
+ ctx.JSON(http.StatusOK, convert.ToTrackedTime(ctx, trackedTime))
}
// ResetIssueTime reset time manual to the given issue
@@ -448,7 +448,7 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
+ ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}
// ListTrackedTimesByRepository lists all tracked times of the repository
@@ -558,7 +558,7 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
}
ctx.SetTotalCountHeader(count)
- ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
+ ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}
// ListMyTrackedTimes lists all tracked times of the current user
@@ -620,5 +620,5 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
}
ctx.SetTotalCountHeader(count)
- ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(trackedTimes))
+ ctx.JSON(http.StatusOK, convert.ToTrackedTimeList(ctx, trackedTimes))
}
diff --git a/routers/api/v1/repo/migrate.go b/routers/api/v1/repo/migrate.go
index ed371d787c..aeef862b1f 100644
--- a/routers/api/v1/repo/migrate.go
+++ b/routers/api/v1/repo/migrate.go
@@ -195,7 +195,7 @@ func Migrate(ctx *context.APIContext) {
}
if err == nil {
- notification.NotifyMigrateRepository(ctx.Doer, repoOwner, repo)
+ notification.NotifyMigrateRepository(ctx, ctx.Doer, repoOwner, repo)
return
}
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index f7e82dab37..fba7ed6462 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -109,19 +109,19 @@ func ListPullRequests(ctx *context.APIContext) {
apiPrs := make([]*api.PullRequest, len(prs))
for i := range prs {
- if err = prs[i].LoadIssue(); err != nil {
+ if err = prs[i].LoadIssue(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
return
}
- if err = prs[i].LoadAttributes(); err != nil {
+ if err = prs[i].LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- if err = prs[i].LoadBaseRepoCtx(ctx); err != nil {
+ if err = prs[i].LoadBaseRepo(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadBaseRepo", err)
return
}
- if err = prs[i].LoadHeadRepoCtx(ctx); err != nil {
+ if err = prs[i].LoadHeadRepo(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadHeadRepo", err)
return
}
@@ -173,11 +173,11 @@ func GetPullRequest(ctx *context.APIContext) {
return
}
- if err = pr.LoadBaseRepoCtx(ctx); err != nil {
+ if err = pr.LoadBaseRepo(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadBaseRepo", err)
return
}
- if err = pr.LoadHeadRepoCtx(ctx); err != nil {
+ if err = pr.LoadHeadRepo(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadHeadRepo", err)
return
}
@@ -300,7 +300,7 @@ func CreatePullRequest(ctx *context.APIContext) {
defer headGitRepo.Close()
// Check if another PR exists with the same targets
- existingPr, err := issues_model.GetUnmergedPullRequest(headRepo.ID, ctx.Repo.Repository.ID, headBranch, baseBranch, issues_model.PullRequestFlowGithub)
+ existingPr, err := issues_model.GetUnmergedPullRequest(ctx, headRepo.ID, ctx.Repo.Repository.ID, headBranch, baseBranch, issues_model.PullRequestFlowGithub)
if err != nil {
if !issues_model.IsErrPullRequestNotExist(err) {
ctx.Error(http.StatusInternalServerError, "GetUnmergedPullRequest", err)
@@ -320,7 +320,7 @@ func CreatePullRequest(ctx *context.APIContext) {
}
if len(form.Labels) > 0 {
- labels, err := issues_model.GetLabelsInRepoByIDs(ctx.Repo.Repository.ID, form.Labels)
+ labels, err := issues_model.GetLabelsInRepoByIDs(ctx, ctx.Repo.Repository.ID, form.Labels)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetLabelsInRepoByIDs", err)
return
@@ -334,7 +334,7 @@ func CreatePullRequest(ctx *context.APIContext) {
}
if ctx.Repo.Owner.IsOrganization() {
- orgLabels, err := issues_model.GetLabelsInOrgByIDs(ctx.Repo.Owner.ID, form.Labels)
+ orgLabels, err := issues_model.GetLabelsInOrgByIDs(ctx, ctx.Repo.Owner.ID, form.Labels)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetLabelsInOrgByIDs", err)
return
@@ -389,7 +389,7 @@ func CreatePullRequest(ctx *context.APIContext) {
}
// Get all assignee IDs
- assigneeIDs, err := issues_model.MakeIDsFromAPIAssigneesToAdd(form.Assignee, form.Assignees)
+ assigneeIDs, err := issues_model.MakeIDsFromAPIAssigneesToAdd(ctx, form.Assignee, form.Assignees)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Error(http.StatusUnprocessableEntity, "", fmt.Sprintf("Assignee does not exist: [name: %s]", err))
@@ -400,7 +400,7 @@ func CreatePullRequest(ctx *context.APIContext) {
}
// Check if the passed assignees is assignable
for _, aID := range assigneeIDs {
- assignee, err := user_model.GetUserByID(aID)
+ assignee, err := user_model.GetUserByIDCtx(ctx, aID)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserByID", err)
return
@@ -483,7 +483,7 @@ func EditPullRequest(ctx *context.APIContext) {
return
}
- err = pr.LoadIssue()
+ err = pr.LoadIssue(ctx)
if err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
return
@@ -551,14 +551,14 @@ func EditPullRequest(ctx *context.APIContext) {
}
if ctx.Repo.CanWrite(unit.TypePullRequests) && form.Labels != nil {
- labels, err := issues_model.GetLabelsInRepoByIDs(ctx.Repo.Repository.ID, form.Labels)
+ labels, err := issues_model.GetLabelsInRepoByIDs(ctx, ctx.Repo.Repository.ID, form.Labels)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetLabelsInRepoByIDsError", err)
return
}
if ctx.Repo.Owner.IsOrganization() {
- orgLabels, err := issues_model.GetLabelsInOrgByIDs(ctx.Repo.Owner.ID, form.Labels)
+ orgLabels, err := issues_model.GetLabelsInOrgByIDs(ctx, ctx.Repo.Owner.ID, form.Labels)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetLabelsInOrgByIDs", err)
return
@@ -591,11 +591,11 @@ func EditPullRequest(ctx *context.APIContext) {
}
if titleChanged {
- notification.NotifyIssueChangeTitle(ctx.Doer, issue, oldTitle)
+ notification.NotifyIssueChangeTitle(ctx, ctx.Doer, issue, oldTitle)
}
if statusChangeComment != nil {
- notification.NotifyIssueChangeStatus(ctx.Doer, issue, statusChangeComment, issue.IsClosed)
+ notification.NotifyIssueChangeStatus(ctx, ctx.Doer, issue, statusChangeComment, issue.IsClosed)
}
// change pull target branch
@@ -619,7 +619,7 @@ func EditPullRequest(ctx *context.APIContext) {
}
return
}
- notification.NotifyPullRequestChangeTargetBranch(ctx.Doer, pr, form.Base)
+ notification.NotifyPullRequestChangeTargetBranch(ctx, ctx.Doer, pr, form.Base)
}
// update allow edits
@@ -743,12 +743,12 @@ func MergePullRequest(ctx *context.APIContext) {
return
}
- if err := pr.LoadHeadRepoCtx(ctx); err != nil {
+ if err := pr.LoadHeadRepo(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadHeadRepo", err)
return
}
- if err := pr.LoadIssueCtx(ctx); err != nil {
+ if err := pr.LoadIssue(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
return
}
@@ -811,7 +811,7 @@ func MergePullRequest(ctx *context.APIContext) {
message := strings.TrimSpace(form.MergeTitleField)
if len(message) == 0 {
- 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.Error(http.StatusInternalServerError, "GetDefaultMergeMessage", err)
return
@@ -1097,7 +1097,7 @@ func UpdatePullRequest(ctx *context.APIContext) {
return
}
- if err = pr.LoadIssue(); err != nil {
+ if err = pr.LoadIssue(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
return
}
@@ -1107,11 +1107,11 @@ func UpdatePullRequest(ctx *context.APIContext) {
return
}
- if err = pr.LoadBaseRepoCtx(ctx); err != nil {
+ if err = pr.LoadBaseRepo(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadBaseRepo", err)
return
}
- if err = pr.LoadHeadRepoCtx(ctx); err != nil {
+ if err = pr.LoadHeadRepo(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadHeadRepo", err)
return
}
@@ -1267,7 +1267,7 @@ func GetPullRequestCommits(ctx *context.APIContext) {
return
}
- if err := pr.LoadBaseRepoCtx(ctx); err != nil {
+ if err := pr.LoadBaseRepo(ctx); err != nil {
ctx.InternalServerError(err)
return
}
@@ -1383,12 +1383,12 @@ func GetPullRequestFiles(ctx *context.APIContext) {
return
}
- if err := pr.LoadBaseRepo(); err != nil {
+ if err := pr.LoadBaseRepo(ctx); err != nil {
ctx.InternalServerError(err)
return
}
- if err := pr.LoadHeadRepo(); err != nil {
+ if err := pr.LoadHeadRepo(ctx); err != nil {
ctx.InternalServerError(err)
return
}
diff --git a/routers/api/v1/repo/pull_review.go b/routers/api/v1/repo/pull_review.go
index f36d0586ab..df88e2a57b 100644
--- a/routers/api/v1/repo/pull_review.go
+++ b/routers/api/v1/repo/pull_review.go
@@ -71,7 +71,7 @@ func ListPullReviews(ctx *context.APIContext) {
return
}
- if err = pr.LoadIssue(); err != nil {
+ if err = pr.LoadIssue(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
return
}
@@ -476,7 +476,7 @@ func SubmitPullReview(ctx *context.APIContext) {
// preparePullReviewType return ReviewType and false or nil and true if an error happen
func preparePullReviewType(ctx *context.APIContext, pr *issues_model.PullRequest, event api.ReviewStateType, body string, hasComments bool) (issues_model.ReviewType, bool) {
- if err := pr.LoadIssue(); err != nil {
+ if err := pr.LoadIssue(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
return -1, true
}
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go
index acc9696e1b..60cc19d565 100644
--- a/routers/api/v1/repo/release.go
+++ b/routers/api/v1/repo/release.go
@@ -61,7 +61,7 @@ func GetRelease(ctx *context.APIContext) {
return
}
- if err := release.LoadAttributes(); err != nil {
+ if err := release.LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
@@ -123,14 +123,14 @@ func ListReleases(ctx *context.APIContext) {
IsPreRelease: ctx.FormOptionalBool("pre-release"),
}
- 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.Error(http.StatusInternalServerError, "GetReleasesByRepoID", err)
return
}
rels := make([]*api.Release, len(releases))
for i, release := range releases {
- if err := release.LoadAttributes(); err != nil {
+ if err := release.LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
@@ -313,7 +313,7 @@ func EditRelease(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetReleaseByID", err)
return
}
- if err := rel.LoadAttributes(); err != nil {
+ if err := rel.LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
diff --git a/routers/api/v1/repo/release_attachment.go b/routers/api/v1/repo/release_attachment.go
index a469877c13..02f85d384a 100644
--- a/routers/api/v1/repo/release_attachment.go
+++ b/routers/api/v1/repo/release_attachment.go
@@ -114,7 +114,7 @@ func ListReleaseAttachments(ctx *context.APIContext) {
ctx.NotFound()
return
}
- if err := release.LoadAttributes(); err != nil {
+ if err := release.LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
diff --git a/routers/api/v1/repo/release_tags.go b/routers/api/v1/repo/release_tags.go
index 2cb97c58a0..77395bb469 100644
--- a/routers/api/v1/repo/release_tags.go
+++ b/routers/api/v1/repo/release_tags.go
@@ -60,7 +60,7 @@ func GetReleaseByTag(ctx *context.APIContext) {
return
}
- if err = release.LoadAttributes(); err != nil {
+ if err = release.LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index de8a4d1864..29febe751c 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -191,7 +191,7 @@ func Search(ctx *context.APIContext) {
}
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,
@@ -209,7 +209,7 @@ func Search(ctx *context.APIContext) {
})
return
}
- accessMode, err := access_model.AccessLevel(ctx.Doer, repo)
+ accessMode, err := access_model.AccessLevel(ctx, ctx.Doer, repo)
if err != nil {
ctx.JSON(http.StatusInternalServerError, api.SearchError{
OK: false,
diff --git a/routers/api/v1/repo/wiki.go b/routers/api/v1/repo/wiki.go
index 6d95648542..734a550a71 100644
--- a/routers/api/v1/repo/wiki.go
+++ b/routers/api/v1/repo/wiki.go
@@ -86,7 +86,7 @@ func NewWikiPage(ctx *context.APIContext) {
wikiPage := getWikiPage(ctx, wikiName)
if !ctx.Written() {
- notification.NotifyNewWikiPage(ctx.Doer, ctx.Repo.Repository, wikiName, form.Message)
+ notification.NotifyNewWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, wikiName, form.Message)
ctx.JSON(http.StatusCreated, wikiPage)
}
}
@@ -154,7 +154,7 @@ func EditWikiPage(ctx *context.APIContext) {
wikiPage := getWikiPage(ctx, newWikiName)
if !ctx.Written() {
- notification.NotifyEditWikiPage(ctx.Doer, ctx.Repo.Repository, newWikiName, form.Message)
+ notification.NotifyEditWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, newWikiName, form.Message)
ctx.JSON(http.StatusOK, wikiPage)
}
}
@@ -245,7 +245,7 @@ func DeleteWikiPage(ctx *context.APIContext) {
return
}
- notification.NotifyDeleteWikiPage(ctx.Doer, ctx.Repo.Repository, wikiName)
+ notification.NotifyDeleteWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, wikiName)
ctx.Status(http.StatusNoContent)
}
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go
index 709e3a6c54..d1917a9938 100644
--- a/routers/api/v1/user/repo.go
+++ b/routers/api/v1/user/repo.go
@@ -39,7 +39,7 @@ func listUserRepos(ctx *context.APIContext, u *user_model.User, private bool) {
apiRepos := make([]*api.Repository, 0, len(repos))
for i := range repos {
- access, err := access_model.AccessLevel(ctx.Doer, repos[i])
+ access, err := access_model.AccessLevel(ctx, ctx.Doer, repos[i])
if err != nil {
ctx.Error(http.StatusInternalServerError, "AccessLevel", err)
return
@@ -112,7 +112,7 @@ func ListMyRepos(ctx *context.APIContext) {
}
var err error
- repos, count, err := repo_model.SearchRepository(opts)
+ repos, count, err := repo_model.SearchRepository(ctx, opts)
if err != nil {
ctx.Error(http.StatusInternalServerError, "SearchRepository", err)
return
@@ -124,7 +124,7 @@ func ListMyRepos(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "GetOwner", err)
return
}
- accessMode, err := access_model.AccessLevel(ctx.Doer, repo)
+ accessMode, err := access_model.AccessLevel(ctx, ctx.Doer, repo)
if err != nil {
ctx.Error(http.StatusInternalServerError, "AccessLevel", err)
}
diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go
index 9cb9ec79b8..96748c630d 100644
--- a/routers/api/v1/user/star.go
+++ b/routers/api/v1/user/star.go
@@ -6,6 +6,7 @@
package user
import (
+ std_context "context"
"net/http"
"code.gitea.io/gitea/models/db"
@@ -20,15 +21,15 @@ import (
// getStarredRepos returns the repos that the user with the specified userID has
// starred
-func getStarredRepos(user *user_model.User, private bool, listOptions db.ListOptions) ([]*api.Repository, error) {
- starredRepos, err := repo_model.GetStarredRepos(user.ID, private, listOptions)
+func getStarredRepos(ctx std_context.Context, user *user_model.User, private bool, listOptions db.ListOptions) ([]*api.Repository, error) {
+ starredRepos, err := repo_model.GetStarredRepos(ctx, user.ID, private, listOptions)
if err != nil {
return nil, err
}
repos := make([]*api.Repository, len(starredRepos))
for i, starred := range starredRepos {
- access, err := access_model.AccessLevel(user, starred)
+ access, err := access_model.AccessLevel(ctx, user, starred)
if err != nil {
return nil, err
}
@@ -63,7 +64,7 @@ func GetStarredRepos(ctx *context.APIContext) {
// "$ref": "#/responses/RepositoryList"
private := ctx.ContextUser.ID == ctx.Doer.ID
- repos, err := getStarredRepos(ctx.ContextUser, private, utils.GetListOptions(ctx))
+ repos, err := getStarredRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "getStarredRepos", err)
return
@@ -93,7 +94,7 @@ func GetMyStarredRepos(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/RepositoryList"
- repos, err := getStarredRepos(ctx.Doer, true, utils.GetListOptions(ctx))
+ repos, err := getStarredRepos(ctx, ctx.Doer, true, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "getStarredRepos", err)
}
diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go
index 83f23db15c..7765a399f3 100644
--- a/routers/api/v1/user/watch.go
+++ b/routers/api/v1/user/watch.go
@@ -5,6 +5,7 @@
package user
import (
+ std_context "context"
"net/http"
"code.gitea.io/gitea/models/db"
@@ -18,15 +19,15 @@ import (
)
// getWatchedRepos returns the repos that the user with the specified userID is watching
-func getWatchedRepos(user *user_model.User, private bool, listOptions db.ListOptions) ([]*api.Repository, int64, error) {
- watchedRepos, total, err := repo_model.GetWatchedRepos(user.ID, private, listOptions)
+func getWatchedRepos(ctx std_context.Context, user *user_model.User, private bool, listOptions db.ListOptions) ([]*api.Repository, int64, error) {
+ watchedRepos, total, err := repo_model.GetWatchedRepos(ctx, user.ID, private, listOptions)
if err != nil {
return nil, 0, err
}
repos := make([]*api.Repository, len(watchedRepos))
for i, watched := range watchedRepos {
- access, err := access_model.AccessLevel(user, watched)
+ access, err := access_model.AccessLevel(ctx, user, watched)
if err != nil {
return nil, 0, err
}
@@ -61,7 +62,7 @@ func GetWatchedRepos(ctx *context.APIContext) {
// "$ref": "#/responses/RepositoryList"
private := ctx.ContextUser.ID == ctx.Doer.ID
- repos, total, err := getWatchedRepos(ctx.ContextUser, private, utils.GetListOptions(ctx))
+ repos, total, err := getWatchedRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "getWatchedRepos", err)
}
@@ -90,7 +91,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/RepositoryList"
- repos, total, err := getWatchedRepos(ctx.Doer, true, utils.GetListOptions(ctx))
+ repos, total, err := getWatchedRepos(ctx, ctx.Doer, true, utils.GetListOptions(ctx))
if err != nil {
ctx.Error(http.StatusInternalServerError, "getWatchedRepos", err)
}