summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/activitypub/person.go2
-rw-r--r--routers/api/v1/admin/org.go4
-rw-r--r--routers/api/v1/admin/user.go6
-rw-r--r--routers/api/v1/org/member.go2
-rw-r--r--routers/api/v1/org/org.go10
-rw-r--r--routers/api/v1/org/team.go16
-rw-r--r--routers/api/v1/repo/branch.go6
-rw-r--r--routers/api/v1/repo/collaborators.go8
-rw-r--r--routers/api/v1/repo/commits.go4
-rw-r--r--routers/api/v1/repo/hook.go6
-rw-r--r--routers/api/v1/repo/issue_comment.go10
-rw-r--r--routers/api/v1/repo/issue_reaction.go12
-rw-r--r--routers/api/v1/repo/issue_subscription.go2
-rw-r--r--routers/api/v1/repo/notes.go2
-rw-r--r--routers/api/v1/repo/pull.go2
-rw-r--r--routers/api/v1/repo/pull_review.go2
-rw-r--r--routers/api/v1/repo/release.go10
-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/star.go2
-rw-r--r--routers/api/v1/repo/subscriber.go2
-rw-r--r--routers/api/v1/repo/tag.go2
-rw-r--r--routers/api/v1/repo/teams.go4
-rw-r--r--routers/api/v1/repo/transfer.go2
-rw-r--r--routers/api/v1/user/follower.go2
-rw-r--r--routers/api/v1/user/key.go13
-rw-r--r--routers/api/v1/user/user.go6
-rw-r--r--routers/common/middleware.go3
-rw-r--r--routers/install/install.go4
-rw-r--r--routers/private/hook_verification.go2
-rw-r--r--routers/web/admin/config.go2
-rw-r--r--routers/web/auth/linkaccount.go2
-rw-r--r--routers/web/auth/oauth.go4
-rw-r--r--routers/web/auth/oauth_test.go4
-rw-r--r--routers/web/auth/openid.go2
-rw-r--r--routers/web/auth/password.go2
-rw-r--r--routers/web/org/teams.go2
-rw-r--r--routers/web/repo/blame.go6
-rw-r--r--routers/web/repo/commit.go8
-rw-r--r--routers/web/repo/issue.go2
-rw-r--r--routers/web/repo/view.go4
-rw-r--r--routers/web/repo/webhook.go2
-rw-r--r--routers/web/user/avatar.go4
-rw-r--r--routers/web/user/search.go2
-rw-r--r--routers/web/webfinger.go4
45 files changed, 101 insertions, 99 deletions
diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go
index 8085580985..492930b849 100644
--- a/routers/api/v1/activitypub/person.go
+++ b/routers/api/v1/activitypub/person.go
@@ -55,7 +55,7 @@ func Person(ctx *context.APIContext) {
person.Icon = ap.Image{
Type: ap.ImageType,
MediaType: "image/png",
- URL: ap.IRI(ctx.ContextUser.AvatarLink()),
+ URL: ap.IRI(ctx.ContextUser.AvatarLink(ctx)),
}
person.Inbox = ap.IRI(link + "/inbox")
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index ff66244184..6d50a12674 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -74,7 +74,7 @@ func CreateOrg(ctx *context.APIContext) {
return
}
- ctx.JSON(http.StatusCreated, convert.ToOrganization(org))
+ ctx.JSON(http.StatusCreated, convert.ToOrganization(ctx, org))
}
// GetAllOrgs API for getting information of all the organizations
@@ -114,7 +114,7 @@ func GetAllOrgs(ctx *context.APIContext) {
}
orgs := make([]*api.Organization, len(users))
for i := range users {
- orgs[i] = convert.ToOrganization(organization.OrgFromUser(users[i]))
+ orgs[i] = convert.ToOrganization(ctx, organization.OrgFromUser(users[i]))
}
ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 6b48ce4a9d..4ee1a320cc 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -140,7 +140,7 @@ func CreateUser(ctx *context.APIContext) {
if form.SendNotify {
mailer.SendRegisterNotifyMail(u)
}
- ctx.JSON(http.StatusCreated, convert.ToUser(u, ctx.Doer))
+ ctx.JSON(http.StatusCreated, convert.ToUser(ctx, u, ctx.Doer))
}
// EditUser api for modifying a user's information
@@ -280,7 +280,7 @@ func EditUser(ctx *context.APIContext) {
}
log.Trace("Account profile updated by admin (%s): %s", ctx.Doer.Name, ctx.ContextUser.Name)
- ctx.JSON(http.StatusOK, convert.ToUser(ctx.ContextUser, ctx.Doer))
+ ctx.JSON(http.StatusOK, convert.ToUser(ctx, ctx.ContextUser, ctx.Doer))
}
// DeleteUser api for deleting a user
@@ -441,7 +441,7 @@ func GetAllUsers(ctx *context.APIContext) {
results := make([]*api.User, len(users))
for i := range users {
- results[i] = convert.ToUser(users[i], ctx.Doer)
+ results[i] = convert.ToUser(ctx, users[i], ctx.Doer)
}
ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go
index 33c9944978..e4afd7f3c6 100644
--- a/routers/api/v1/org/member.go
+++ b/routers/api/v1/org/member.go
@@ -39,7 +39,7 @@ func listMembers(ctx *context.APIContext, publicOnly bool) {
apiMembers := make([]*api.User, len(members))
for i, member := range members {
- apiMembers[i] = convert.ToUser(member, ctx.Doer)
+ apiMembers[i] = convert.ToUser(ctx, member, ctx.Doer)
}
ctx.SetTotalCountHeader(count)
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index a1b071d488..75420dcc43 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -42,7 +42,7 @@ func listUserOrgs(ctx *context.APIContext, u *user_model.User) {
apiOrgs := make([]*api.Organization, len(orgs))
for i := range orgs {
- apiOrgs[i] = convert.ToOrganization(orgs[i])
+ apiOrgs[i] = convert.ToOrganization(ctx, orgs[i])
}
ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
@@ -211,7 +211,7 @@ func GetAll(ctx *context.APIContext) {
}
orgs := make([]*api.Organization, len(publicOrgs))
for i := range publicOrgs {
- orgs[i] = convert.ToOrganization(organization.OrgFromUser(publicOrgs[i]))
+ orgs[i] = convert.ToOrganization(ctx, organization.OrgFromUser(publicOrgs[i]))
}
ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
@@ -274,7 +274,7 @@ func Create(ctx *context.APIContext) {
return
}
- ctx.JSON(http.StatusCreated, convert.ToOrganization(org))
+ ctx.JSON(http.StatusCreated, convert.ToOrganization(ctx, org))
}
// Get get an organization
@@ -298,7 +298,7 @@ func Get(ctx *context.APIContext) {
ctx.NotFound("HasOrgOrUserVisible", nil)
return
}
- ctx.JSON(http.StatusOK, convert.ToOrganization(ctx.Org.Organization))
+ ctx.JSON(http.StatusOK, convert.ToOrganization(ctx, ctx.Org.Organization))
}
// Edit change an organization's information
@@ -344,7 +344,7 @@ func Edit(ctx *context.APIContext) {
return
}
- ctx.JSON(http.StatusOK, convert.ToOrganization(org))
+ ctx.JSON(http.StatusOK, convert.ToOrganization(ctx, org))
}
// Delete an organization
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index 8f87e82764..686e48ece3 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -58,7 +58,7 @@ func ListTeams(ctx *context.APIContext) {
return
}
- apiTeams, err := convert.ToTeams(teams, false)
+ apiTeams, err := convert.ToTeams(ctx, teams, false)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ConvertToTeams", err)
return
@@ -97,7 +97,7 @@ func ListUserTeams(ctx *context.APIContext) {
return
}
- apiTeams, err := convert.ToTeams(teams, true)
+ apiTeams, err := convert.ToTeams(ctx, teams, true)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ConvertToTeams", err)
return
@@ -125,7 +125,7 @@ func GetTeam(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/Team"
- apiTeam, err := convert.ToTeam(ctx.Org.Team)
+ apiTeam, err := convert.ToTeam(ctx, ctx.Org.Team)
if err != nil {
ctx.InternalServerError(err)
return
@@ -223,7 +223,7 @@ func CreateTeam(ctx *context.APIContext) {
return
}
- apiTeam, err := convert.ToTeam(team)
+ apiTeam, err := convert.ToTeam(ctx, team)
if err != nil {
ctx.InternalServerError(err)
return
@@ -306,7 +306,7 @@ func EditTeam(ctx *context.APIContext) {
return
}
- apiTeam, err := convert.ToTeam(team)
+ apiTeam, err := convert.ToTeam(ctx, team)
if err != nil {
ctx.InternalServerError(err)
return
@@ -383,7 +383,7 @@ func GetTeamMembers(ctx *context.APIContext) {
members := make([]*api.User, len(teamMembers))
for i, member := range teamMembers {
- members[i] = convert.ToUser(member, ctx.Doer)
+ members[i] = convert.ToUser(ctx, member, ctx.Doer)
}
ctx.SetTotalCountHeader(int64(ctx.Org.Team.NumMembers))
@@ -428,7 +428,7 @@ func GetTeamMember(ctx *context.APIContext) {
ctx.NotFound()
return
}
- ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.Doer))
+ ctx.JSON(http.StatusOK, convert.ToUser(ctx, u, ctx.Doer))
}
// AddTeamMember api for add a member to a team
@@ -779,7 +779,7 @@ func SearchTeam(ctx *context.APIContext) {
return
}
- apiTeams, err := convert.ToTeams(teams, false)
+ apiTeams, err := convert.ToTeams(ctx, teams, false)
if err != nil {
ctx.InternalServerError(err)
return
diff --git a/routers/api/v1/repo/branch.go b/routers/api/v1/repo/branch.go
index eacec6a609..8acaeaffb4 100644
--- a/routers/api/v1/repo/branch.go
+++ b/routers/api/v1/repo/branch.go
@@ -76,7 +76,7 @@ func GetBranch(ctx *context.APIContext) {
return
}
- br, err := convert.ToBranch(ctx.Repo.Repository, branch, c, branchProtection, ctx.Doer, ctx.Repo.IsAdmin())
+ br, err := convert.ToBranch(ctx, ctx.Repo.Repository, branch, c, branchProtection, ctx.Doer, ctx.Repo.IsAdmin())
if err != nil {
ctx.Error(http.StatusInternalServerError, "convert.ToBranch", err)
return
@@ -212,7 +212,7 @@ func CreateBranch(ctx *context.APIContext) {
return
}
- br, err := convert.ToBranch(ctx.Repo.Repository, branch, commit, branchProtection, ctx.Doer, ctx.Repo.IsAdmin())
+ br, err := convert.ToBranch(ctx, ctx.Repo.Repository, branch, commit, branchProtection, ctx.Doer, ctx.Repo.IsAdmin())
if err != nil {
ctx.Error(http.StatusInternalServerError, "convert.ToBranch", err)
return
@@ -284,7 +284,7 @@ func ListBranches(ctx *context.APIContext) {
}
branchProtection := rules.GetFirstMatched(branches[i].Name)
- apiBranch, err := convert.ToBranch(ctx.Repo.Repository, branches[i], c, branchProtection, ctx.Doer, ctx.Repo.IsAdmin())
+ apiBranch, err := convert.ToBranch(ctx, ctx.Repo.Repository, branches[i], c, branchProtection, ctx.Doer, ctx.Repo.IsAdmin())
if err != nil {
ctx.Error(http.StatusInternalServerError, "convert.ToBranch", err)
return
diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go
index 293778420b..942d4c799f 100644
--- a/routers/api/v1/repo/collaborators.go
+++ b/routers/api/v1/repo/collaborators.go
@@ -65,7 +65,7 @@ func ListCollaborators(ctx *context.APIContext) {
users := make([]*api.User, len(collaborators))
for i, collaborator := range collaborators {
- users[i] = convert.ToUser(collaborator.User, ctx.Doer)
+ users[i] = convert.ToUser(ctx, collaborator.User, ctx.Doer)
}
ctx.SetTotalCountHeader(count)
@@ -287,7 +287,7 @@ func GetRepoPermissions(ctx *context.APIContext) {
return
}
- ctx.JSON(http.StatusOK, convert.ToUserAndPermission(collaborator, ctx.ContextUser, permission.AccessMode))
+ ctx.JSON(http.StatusOK, convert.ToUserAndPermission(ctx, collaborator, ctx.ContextUser, permission.AccessMode))
}
// GetReviewers return all users that can be requested to review in this repo
@@ -317,7 +317,7 @@ func GetReviewers(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "ListCollaborators", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToUsers(ctx.Doer, reviewers))
+ ctx.JSON(http.StatusOK, convert.ToUsers(ctx, ctx.Doer, reviewers))
}
// GetAssignees return all users that have write access and can be assigned to issues
@@ -347,5 +347,5 @@ func GetAssignees(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "ListCollaborators", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToUsers(ctx.Doer, assignees))
+ ctx.JSON(http.StatusOK, convert.ToUsers(ctx, ctx.Doer, assignees))
}
diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go
index 68a92ca2a8..22b013e7dc 100644
--- a/routers/api/v1/repo/commits.go
+++ b/routers/api/v1/repo/commits.go
@@ -69,7 +69,7 @@ func getCommit(ctx *context.APIContext, identifier string) {
return
}
- json, err := convert.ToCommit(ctx.Repo.Repository, ctx.Repo.GitRepo, commit, nil, true)
+ json, err := convert.ToCommit(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, commit, nil, true)
if err != nil {
ctx.Error(http.StatusInternalServerError, "toCommit", err)
return
@@ -217,7 +217,7 @@ func GetAllCommits(ctx *context.APIContext) {
for i, commit := range commits {
// Create json struct
- apiCommits[i], err = convert.ToCommit(ctx.Repo.Repository, ctx.Repo.GitRepo, commit, userCache, stat)
+ apiCommits[i], err = convert.ToCommit(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, commit, userCache, stat)
if err != nil {
ctx.Error(http.StatusInternalServerError, "toCommit", err)
return
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 100a28d7f6..fd54d1f740 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -174,7 +174,7 @@ func TestHook(ctx *context.APIContext) {
return
}
- commit := convert.ToPayloadCommit(ctx.Repo.Repository, ctx.Repo.Commit)
+ commit := convert.ToPayloadCommit(ctx, ctx.Repo.Repository, ctx.Repo.Commit)
commitID := ctx.Repo.Commit.ID.String()
if err := webhook_service.PrepareWebhook(ctx, hook, webhook_module.HookEventPush, &api.PushPayload{
@@ -186,8 +186,8 @@ func TestHook(ctx *context.APIContext) {
TotalCommits: 1,
HeadCommit: commit,
Repo: convert.ToRepo(ctx, ctx.Repo.Repository, perm.AccessModeNone),
- Pusher: convert.ToUserWithAccessMode(ctx.Doer, perm.AccessModeNone),
- Sender: convert.ToUserWithAccessMode(ctx.Doer, perm.AccessModeNone),
+ Pusher: convert.ToUserWithAccessMode(ctx, ctx.Doer, perm.AccessModeNone),
+ Sender: convert.ToUserWithAccessMode(ctx, ctx.Doer, perm.AccessModeNone),
}); err != nil {
ctx.Error(http.StatusInternalServerError, "PrepareWebhook: ", err)
return
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index 40c92998d1..3d14343d47 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -103,7 +103,7 @@ func ListIssueComments(ctx *context.APIContext) {
apiComments := make([]*api.Comment, len(comments))
for i, comment := range comments {
comment.Issue = issue
- apiComments[i] = convert.ToComment(comments[i])
+ apiComments[i] = convert.ToComment(ctx, comments[i])
}
ctx.SetTotalCountHeader(totalCount)
@@ -308,7 +308,7 @@ func ListRepoIssueComments(ctx *context.APIContext) {
return
}
for i := range comments {
- apiComments[i] = convert.ToComment(comments[i])
+ apiComments[i] = convert.ToComment(ctx, comments[i])
}
ctx.SetTotalCountHeader(totalCount)
@@ -368,7 +368,7 @@ func CreateIssueComment(ctx *context.APIContext) {
return
}
- ctx.JSON(http.StatusCreated, convert.ToComment(comment))
+ ctx.JSON(http.StatusCreated, convert.ToComment(ctx, comment))
}
// GetIssueComment Get a comment by ID
@@ -436,7 +436,7 @@ func GetIssueComment(ctx *context.APIContext) {
return
}
- ctx.JSON(http.StatusOK, convert.ToComment(comment))
+ ctx.JSON(http.StatusOK, convert.ToComment(ctx, comment))
}
// EditIssueComment modify a comment of an issue
@@ -561,7 +561,7 @@ func editIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
return
}
- ctx.JSON(http.StatusOK, convert.ToComment(comment))
+ ctx.JSON(http.StatusOK, convert.ToComment(ctx, comment))
}
// DeleteIssueComment delete a comment from an issue
diff --git a/routers/api/v1/repo/issue_reaction.go b/routers/api/v1/repo/issue_reaction.go
index 1b998a5354..921f6e53f9 100644
--- a/routers/api/v1/repo/issue_reaction.go
+++ b/routers/api/v1/repo/issue_reaction.go
@@ -80,7 +80,7 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
var result []api.Reaction
for _, r := range reactions {
result = append(result, api.Reaction{
- User: convert.ToUser(r.User, ctx.Doer),
+ User: convert.ToUser(ctx, r.User, ctx.Doer),
Reaction: r.Type,
Created: r.CreatedUnix.AsTime(),
})
@@ -202,7 +202,7 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp
ctx.Error(http.StatusForbidden, err.Error(), err)
} else if issues_model.IsErrReactionAlreadyExist(err) {
ctx.JSON(http.StatusOK, api.Reaction{
- User: convert.ToUser(ctx.Doer, ctx.Doer),
+ User: convert.ToUser(ctx, ctx.Doer, ctx.Doer),
Reaction: reaction.Type,
Created: reaction.CreatedUnix.AsTime(),
})
@@ -213,7 +213,7 @@ func changeIssueCommentReaction(ctx *context.APIContext, form api.EditReactionOp
}
ctx.JSON(http.StatusCreated, api.Reaction{
- User: convert.ToUser(ctx.Doer, ctx.Doer),
+ User: convert.ToUser(ctx, ctx.Doer, ctx.Doer),
Reaction: reaction.Type,
Created: reaction.CreatedUnix.AsTime(),
})
@@ -298,7 +298,7 @@ func GetIssueReactions(ctx *context.APIContext) {
var result []api.Reaction
for _, r := range reactions {
result = append(result, api.Reaction{
- User: convert.ToUser(r.User, ctx.Doer),
+ User: convert.ToUser(ctx, r.User, ctx.Doer),
Reaction: r.Type,
Created: r.CreatedUnix.AsTime(),
})
@@ -412,7 +412,7 @@ func changeIssueReaction(ctx *context.APIContext, form api.EditReactionOption, i
ctx.Error(http.StatusForbidden, err.Error(), err)
} else if issues_model.IsErrReactionAlreadyExist(err) {
ctx.JSON(http.StatusOK, api.Reaction{
- User: convert.ToUser(ctx.Doer, ctx.Doer),
+ User: convert.ToUser(ctx, ctx.Doer, ctx.Doer),
Reaction: reaction.Type,
Created: reaction.CreatedUnix.AsTime(),
})
@@ -423,7 +423,7 @@ func changeIssueReaction(ctx *context.APIContext, form api.EditReactionOption, i
}
ctx.JSON(http.StatusCreated, api.Reaction{
- User: convert.ToUser(ctx.Doer, ctx.Doer),
+ User: convert.ToUser(ctx, ctx.Doer, ctx.Doer),
Reaction: reaction.Type,
Created: reaction.CreatedUnix.AsTime(),
})
diff --git a/routers/api/v1/repo/issue_subscription.go b/routers/api/v1/repo/issue_subscription.go
index 6d22c82652..107119eb08 100644
--- a/routers/api/v1/repo/issue_subscription.go
+++ b/routers/api/v1/repo/issue_subscription.go
@@ -280,7 +280,7 @@ func GetIssueSubscribers(ctx *context.APIContext) {
}
apiUsers := make([]*api.User, 0, len(users))
for _, v := range users {
- apiUsers = append(apiUsers, convert.ToUser(v, ctx.Doer))
+ apiUsers = append(apiUsers, convert.ToUser(ctx, v, ctx.Doer))
}
count, err := issues_model.CountIssueWatchers(ctx, issue.ID)
diff --git a/routers/api/v1/repo/notes.go b/routers/api/v1/repo/notes.go
index 8eaa503ff7..2d1f3291f8 100644
--- a/routers/api/v1/repo/notes.go
+++ b/routers/api/v1/repo/notes.go
@@ -68,7 +68,7 @@ func getNote(ctx *context.APIContext, identifier string) {
return
}
- cmt, err := convert.ToCommit(ctx.Repo.Repository, ctx.Repo.GitRepo, note.Commit, nil, true)
+ cmt, err := convert.ToCommit(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, note.Commit, nil, true)
if err != nil {
ctx.Error(http.StatusInternalServerError, "ToCommit", err)
return
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 8164b38694..7005725cf6 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -1311,7 +1311,7 @@ func GetPullRequestCommits(ctx *context.APIContext) {
apiCommits := make([]*api.Commit, 0, end-start)
for i := start; i < end; i++ {
- apiCommit, err := convert.ToCommit(ctx.Repo.Repository, baseGitRepo, commits[i], userCache, true)
+ apiCommit, err := convert.ToCommit(ctx, ctx.Repo.Repository, baseGitRepo, commits[i], userCache, true)
if err != nil {
ctx.ServerError("toCommit", err)
return
diff --git a/routers/api/v1/repo/pull_review.go b/routers/api/v1/repo/pull_review.go
index 96dc1fc2de..f6acaa780a 100644
--- a/routers/api/v1/repo/pull_review.go
+++ b/routers/api/v1/repo/pull_review.go
@@ -673,7 +673,7 @@ func apiReviewRequest(ctx *context.APIContext, opts api.PullReviewRequestOptions
for _, r := range opts.Reviewers {
var reviewer *user_model.User
if strings.Contains(r, "@") {
- reviewer, err = user_model.GetUserByEmail(r)
+ reviewer, err = user_model.GetUserByEmail(ctx, r)
} else {
reviewer, err = user_model.GetUserByName(ctx, r)
}
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go
index c01e66150f..e9693dd053 100644
--- a/routers/api/v1/repo/release.go
+++ b/routers/api/v1/repo/release.go
@@ -64,7 +64,7 @@ func GetRelease(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToRelease(release))
+ ctx.JSON(http.StatusOK, convert.ToRelease(ctx, release))
}
// GetLatestRelease gets the most recent non-prerelease, non-draft release of a repository, sorted by created_at
@@ -105,7 +105,7 @@ func GetLatestRelease(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToRelease(release))
+ ctx.JSON(http.StatusOK, convert.ToRelease(ctx, release))
}
// ListReleases list a repository's releases
@@ -174,7 +174,7 @@ func ListReleases(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- rels[i] = convert.ToRelease(release)
+ rels[i] = convert.ToRelease(ctx, release)
}
filteredCount, err := repo_model.CountReleasesByRepoID(ctx.Repo.Repository.ID, opts)
@@ -272,7 +272,7 @@ func CreateRelease(ctx *context.APIContext) {
return
}
}
- ctx.JSON(http.StatusCreated, convert.ToRelease(rel))
+ ctx.JSON(http.StatusCreated, convert.ToRelease(ctx, rel))
}
// EditRelease edit a release
@@ -357,7 +357,7 @@ func EditRelease(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToRelease(rel))
+ ctx.JSON(http.StatusOK, convert.ToRelease(ctx, rel))
}
// DeleteRelease delete a release from a repository
diff --git a/routers/api/v1/repo/release_attachment.go b/routers/api/v1/repo/release_attachment.go
index 5aaea693c0..597578aac5 100644
--- a/routers/api/v1/repo/release_attachment.go
+++ b/routers/api/v1/repo/release_attachment.go
@@ -117,7 +117,7 @@ func ListReleaseAttachments(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToRelease(release).Attachments)
+ ctx.JSON(http.StatusOK, convert.ToRelease(ctx, release).Attachments)
}
// CreateReleaseAttachment creates an attachment and saves the given file
diff --git a/routers/api/v1/repo/release_tags.go b/routers/api/v1/repo/release_tags.go
index 7cc846fdc4..051ee8f22e 100644
--- a/routers/api/v1/repo/release_tags.go
+++ b/routers/api/v1/repo/release_tags.go
@@ -63,7 +63,7 @@ func GetReleaseByTag(ctx *context.APIContext) {
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
return
}
- ctx.JSON(http.StatusOK, convert.ToRelease(release))
+ ctx.JSON(http.StatusOK, convert.ToRelease(ctx, release))
}
// DeleteReleaseByTag delete a release from a repository by tag name
diff --git a/routers/api/v1/repo/star.go b/routers/api/v1/repo/star.go
index c7b2eb01ff..e4cf0ffab6 100644
--- a/routers/api/v1/repo/star.go
+++ b/routers/api/v1/repo/star.go
@@ -50,7 +50,7 @@ func ListStargazers(ctx *context.APIContext) {
}
users := make([]*api.User, len(stargazers))
for i, stargazer := range stargazers {
- users[i] = convert.ToUser(stargazer, ctx.Doer)
+ users[i] = convert.ToUser(ctx, stargazer, ctx.Doer)
}
ctx.SetTotalCountHeader(int64(ctx.Repo.Repository.NumStars))
diff --git a/routers/api/v1/repo/subscriber.go b/routers/api/v1/repo/subscriber.go
index 6cd369898e..613fbee409 100644
--- a/routers/api/v1/repo/subscriber.go
+++ b/routers/api/v1/repo/subscriber.go
@@ -50,7 +50,7 @@ func ListSubscribers(ctx *context.APIContext) {
}
users := make([]*api.User, len(subscribers))
for i, subscriber := range subscribers {
- users[i] = convert.ToUser(subscriber, ctx.Doer)
+ users[i] = convert.ToUser(ctx, subscriber, ctx.Doer)
}
ctx.SetTotalCountHeader(int64(ctx.Repo.Repository.NumWatches))
diff --git a/routers/api/v1/repo/tag.go b/routers/api/v1/repo/tag.go
index cb65e2b651..b28b6b0b91 100644
--- a/routers/api/v1/repo/tag.go
+++ b/routers/api/v1/repo/tag.go
@@ -107,7 +107,7 @@ func GetAnnotatedTag(ctx *context.APIContext) {
if err != nil {
ctx.Error(http.StatusBadRequest, "GetAnnotatedTag", err)
}
- ctx.JSON(http.StatusOK, convert.ToAnnotatedTag(ctx.Repo.Repository, tag, commit))
+ ctx.JSON(http.StatusOK, convert.ToAnnotatedTag(ctx, ctx.Repo.Repository, tag, commit))
}
}
diff --git a/routers/api/v1/repo/teams.go b/routers/api/v1/repo/teams.go
index eafe4236ec..01292f18d8 100644
--- a/routers/api/v1/repo/teams.go
+++ b/routers/api/v1/repo/teams.go
@@ -47,7 +47,7 @@ func ListTeams(ctx *context.APIContext) {
return
}
- apiTeams, err := convert.ToTeams(teams, false)
+ apiTeams, err := convert.ToTeams(ctx, teams, false)
if err != nil {
ctx.InternalServerError(err)
return
@@ -98,7 +98,7 @@ func IsTeam(ctx *context.APIContext) {
}
if models.HasRepository(team, ctx.Repo.Repository.ID) {
- apiTeam, err := convert.ToTeam(team)
+ apiTeam, err := convert.ToTeam(ctx, team)
if err != nil {
ctx.InternalServerError(err)
return
diff --git a/routers/api/v1/repo/transfer.go b/routers/api/v1/repo/transfer.go
index aec398da7a..ded8edd41c 100644
--- a/routers/api/v1/repo/transfer.go
+++ b/routers/api/v1/repo/transfer.go
@@ -81,7 +81,7 @@ func Transfer(ctx *context.APIContext) {
return
}
- org := convert.ToOrganization(organization.OrgFromUser(newOwner))
+ org := convert.ToOrganization(ctx, organization.OrgFromUser(newOwner))
for _, tID := range *opts.TeamIDs {
team, err := organization.GetTeamByID(ctx, tID)
if err != nil {
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go
index e9d4ae478b..bc03b22ea7 100644
--- a/routers/api/v1/user/follower.go
+++ b/routers/api/v1/user/follower.go
@@ -17,7 +17,7 @@ import (
func responseAPIUsers(ctx *context.APIContext, users []*user_model.User) {
apiUsers := make([]*api.User, len(users))
for i := range users {
- apiUsers[i] = convert.ToUser(users[i], ctx.Doer)
+ apiUsers[i] = convert.ToUser(ctx, users[i], ctx.Doer)
}
ctx.JSON(http.StatusOK, &apiUsers)
}
diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go
index 8aad69884f..f90c65817d 100644
--- a/routers/api/v1/user/key.go
+++ b/routers/api/v1/user/key.go
@@ -4,6 +4,7 @@
package user
import (
+ std_ctx "context"
"net/http"
asymkey_model "code.gitea.io/gitea/models/asymkey"
@@ -21,20 +22,20 @@ import (
)
// appendPrivateInformation appends the owner and key type information to api.PublicKey
-func appendPrivateInformation(apiKey *api.PublicKey, key *asymkey_model.PublicKey, defaultUser *user_model.User) (*api.PublicKey, error) {
+func appendPrivateInformation(ctx std_ctx.Context, apiKey *api.PublicKey, key *asymkey_model.PublicKey, defaultUser *user_model.User) (*api.PublicKey, error) {
if key.Type == asymkey_model.KeyTypeDeploy {
apiKey.KeyType = "deploy"
} else if key.Type == asymkey_model.KeyTypeUser {
apiKey.KeyType = "user"
if defaultUser.ID == key.OwnerID {
- apiKey.Owner = convert.ToUser(defaultUser, defaultUser)
+ apiKey.Owner = convert.ToUser(ctx, defaultUser, defaultUser)
} else {
user, err := user_model.GetUserByID(db.DefaultContext, key.OwnerID)
if err != nil {
return apiKey, err
}
- apiKey.Owner = convert.ToUser(user, user)
+ apiKey.Owner = convert.ToUser(ctx, user, user)
}
} else {
apiKey.KeyType = "unknown"
@@ -87,7 +88,7 @@ func listPublicKeys(ctx *context.APIContext, user *user_model.User) {
for i := range keys {
apiKeys[i] = convert.ToPublicKey(apiLink, keys[i])
if ctx.Doer.IsAdmin || ctx.Doer.ID == keys[i].OwnerID {
- apiKeys[i], _ = appendPrivateInformation(apiKeys[i], keys[i], user)
+ apiKeys[i], _ = appendPrivateInformation(ctx, apiKeys[i], keys[i], user)
}
}
@@ -187,7 +188,7 @@ func GetPublicKey(ctx *context.APIContext) {
apiLink := composePublicKeysAPILink()
apiKey := convert.ToPublicKey(apiLink, key)
if ctx.Doer.IsAdmin || ctx.Doer.ID == key.OwnerID {
- apiKey, _ = appendPrivateInformation(apiKey, key, ctx.Doer)
+ apiKey, _ = appendPrivateInformation(ctx, apiKey, key, ctx.Doer)
}
ctx.JSON(http.StatusOK, apiKey)
}
@@ -208,7 +209,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
apiLink := composePublicKeysAPILink()
apiKey := convert.ToPublicKey(apiLink, key)
if ctx.Doer.IsAdmin || ctx.Doer.ID == key.OwnerID {
- apiKey, _ = appendPrivateInformation(apiKey, key, ctx.Doer)
+ apiKey, _ = appendPrivateInformation(ctx, apiKey, key, ctx.Doer)
}
ctx.JSON(http.StatusCreated, apiKey)
}
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index 55f3df40b9..6fd4b3a95c 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -74,7 +74,7 @@ func Search(ctx *context.APIContext) {
ctx.JSON(http.StatusOK, map[string]interface{}{
"ok": true,
- "data": convert.ToUsers(ctx.Doer, users),
+ "data": convert.ToUsers(ctx, ctx.Doer, users),
})
}
@@ -102,7 +102,7 @@ func GetInfo(ctx *context.APIContext) {
ctx.NotFound("GetUserByName", user_model.ErrUserNotExist{Name: ctx.Params(":username")})
return
}
- ctx.JSON(http.StatusOK, convert.ToUser(ctx.ContextUser, ctx.Doer))
+ ctx.JSON(http.StatusOK, convert.ToUser(ctx, ctx.ContextUser, ctx.Doer))
}
// GetAuthenticatedUser get current user's information
@@ -116,7 +116,7 @@ func GetAuthenticatedUser(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/User"
- ctx.JSON(http.StatusOK, convert.ToUser(ctx.Doer, ctx.Doer))
+ ctx.JSON(http.StatusOK, convert.ToUser(ctx, ctx.Doer, ctx.Doer))
}
// GetUserHeatmapData is the handler to get a users heatmap
diff --git a/routers/common/middleware.go b/routers/common/middleware.go
index 0c7838b0ef..d664bfccfa 100644
--- a/routers/common/middleware.go
+++ b/routers/common/middleware.go
@@ -8,6 +8,7 @@ import (
"net/http"
"strings"
+ "code.gitea.io/gitea/modules/cache"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
@@ -28,7 +29,7 @@ func Middlewares() []func(http.Handler) http.Handler {
ctx, _, finished := process.GetManager().AddTypedContext(req.Context(), fmt.Sprintf("%s: %s", req.Method, req.RequestURI), process.RequestProcessType, true)
defer finished()
- next.ServeHTTP(context.NewResponse(resp), req.WithContext(ctx))
+ next.ServeHTTP(context.NewResponse(resp), req.WithContext(cache.WithCacheContext(ctx)))
})
},
}
diff --git a/routers/install/install.go b/routers/install/install.go
index e9fa844a09..5d7ecff48f 100644
--- a/routers/install/install.go
+++ b/routers/install/install.go
@@ -441,11 +441,11 @@ func SubmitInstall(ctx *context.Context) {
cfg.Section("server").Key("OFFLINE_MODE").SetValue(fmt.Sprint(form.OfflineMode))
// if you are reinstalling, this maybe not right because of missing version
- if err := system_model.SetSettingNoVersion(system_model.KeyPictureDisableGravatar, strconv.FormatBool(form.DisableGravatar)); err != nil {
+ if err := system_model.SetSettingNoVersion(ctx, system_model.KeyPictureDisableGravatar, strconv.FormatBool(form.DisableGravatar)); err != nil {
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
return
}
- if err := system_model.SetSettingNoVersion(system_model.KeyPictureEnableFederatedAvatar, strconv.FormatBool(form.EnableFederatedAvatar)); err != nil {
+ if err := system_model.SetSettingNoVersion(ctx, system_model.KeyPictureEnableFederatedAvatar, strconv.FormatBool(form.EnableFederatedAvatar)); err != nil {
ctx.RenderWithErr(ctx.Tr("install.save_config_failed", err), tplInstall, &form)
return
}
diff --git a/routers/private/hook_verification.go b/routers/private/hook_verification.go
index 7b9550dfdd..8ccde4f3d7 100644
--- a/routers/private/hook_verification.go
+++ b/routers/private/hook_verification.go
@@ -101,7 +101,7 @@ func readAndVerifyCommit(sha string, repo *git.Repository, env []string) error {
if err != nil {
return err
}
- verification := asymkey_model.ParseCommitWithSignature(commit)
+ verification := asymkey_model.ParseCommitWithSignature(ctx, commit)
if !verification.Verified {
cancel()
return &errUnverifiedCommit{
diff --git a/routers/web/admin/config.go b/routers/web/admin/config.go
index 1f71e81785..73ce4cb990 100644
--- a/routers/web/admin/config.go
+++ b/routers/web/admin/config.go
@@ -213,7 +213,7 @@ func ChangeConfig(ctx *context.Context) {
}
}
- if err := system_model.SetSetting(&system_model.Setting{
+ if err := system_model.SetSetting(ctx, &system_model.Setting{
SettingKey: key,
SettingValue: value,
Version: version,
diff --git a/routers/web/auth/linkaccount.go b/routers/web/auth/linkaccount.go
index 47a0daa06d..865bcca152 100644
--- a/routers/web/auth/linkaccount.go
+++ b/routers/web/auth/linkaccount.go
@@ -59,7 +59,7 @@ func LinkAccount(ctx *context.Context) {
ctx.Data["email"] = email
if len(email) != 0 {
- u, err := user_model.GetUserByEmail(email)
+ u, err := user_model.GetUserByEmail(ctx, email)
if err != nil && !user_model.IsErrUserNotExist(err) {
ctx.ServerError("UserSignIn", err)
return
diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go
index a11417da16..7de63dbe94 100644
--- a/routers/web/auth/oauth.go
+++ b/routers/web/auth/oauth.go
@@ -225,7 +225,7 @@ func newAccessTokenResponse(ctx stdContext.Context, grant *auth.OAuth2Grant, ser
idToken.Name = user.GetDisplayName()
idToken.PreferredUsername = user.Name
idToken.Profile = user.HTMLURL()
- idToken.Picture = user.AvatarLink()
+ idToken.Picture = user.AvatarLink(ctx)
idToken.Website = user.Website
idToken.Locale = user.Language
idToken.UpdatedAt = user.UpdatedUnix
@@ -286,7 +286,7 @@ func InfoOAuth(ctx *context.Context) {
Name: ctx.Doer.FullName,
Username: ctx.Doer.Name,
Email: ctx.Doer.Email,
- Picture: ctx.Doer.AvatarLink(),
+ Picture: ctx.Doer.AvatarLink(ctx),
}
groups, err := getOAuthGroupsForUser(ctx.Doer)
diff --git a/routers/web/auth/oauth_test.go b/routers/web/auth/oauth_test.go
index 5116b4fc71..62f723600d 100644
--- a/routers/web/auth/oauth_test.go
+++ b/routers/web/auth/oauth_test.go
@@ -69,7 +69,7 @@ func TestNewAccessTokenResponse_OIDCToken(t *testing.T) {
assert.Equal(t, user.Name, oidcToken.Name)
assert.Equal(t, user.Name, oidcToken.PreferredUsername)
assert.Equal(t, user.HTMLURL(), oidcToken.Profile)
- assert.Equal(t, user.AvatarLink(), oidcToken.Picture)
+ assert.Equal(t, user.AvatarLink(db.DefaultContext), oidcToken.Picture)
assert.Equal(t, user.Website, oidcToken.Website)
assert.Equal(t, user.UpdatedUnix, oidcToken.UpdatedAt)
assert.Equal(t, user.Email, oidcToken.Email)
@@ -87,7 +87,7 @@ func TestNewAccessTokenResponse_OIDCToken(t *testing.T) {
assert.Equal(t, user.FullName, oidcToken.Name)
assert.Equal(t, user.Name, oidcToken.PreferredUsername)
assert.Equal(t, user.HTMLURL(), oidcToken.Profile)
- assert.Equal(t, user.AvatarLink(), oidcToken.Picture)
+ assert.Equal(t, user.AvatarLink(db.DefaultContext), oidcToken.Picture)
assert.Equal(t, user.Website, oidcToken.Website)
assert.Equal(t, user.UpdatedUnix, oidcToken.UpdatedAt)
assert.Equal(t, user.Email, oidcToken.Email)
diff --git a/routers/web/auth/openid.go b/routers/web/auth/openid.go
index f544b65356..aff2e5f780 100644
--- a/routers/web/auth/openid.go
+++ b/routers/web/auth/openid.go
@@ -197,7 +197,7 @@ func signInOpenIDVerify(ctx *context.Context) {
log.Trace("User has email=%s and nickname=%s", email, nickname)
if email != "" {
- u, err = user_model.GetUserByEmail(email)
+ u, err = user_model.GetUserByEmail(ctx, email)
if err != nil {
if !user_model.IsErrUserNotExist(err) {
ctx.RenderWithErr(err.Error(), tplSignInOpenID, &forms.SignInOpenIDForm{
diff --git a/routers/web/auth/password.go b/routers/web/auth/password.go
index e546c77bc9..16628645d7 100644
--- a/routers/web/auth/password.go
+++ b/routers/web/auth/password.go
@@ -59,7 +59,7 @@ func ForgotPasswdPost(ctx *context.Context) {
email := ctx.FormString("email")
ctx.Data["Email"] = email
- u, err := user_model.GetUserByEmail(email)
+ u, err := user_model.GetUserByEmail(ctx, email)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.Data["ResetPwdCodeLives"] = timeutil.MinutesToFriendly(setting.Service.ResetPwdCodeLives, ctx.Locale)
diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go
index d9754633bf..1ed7980145 100644
--- a/routers/web/org/teams.go
+++ b/routers/web/org/teams.go
@@ -401,7 +401,7 @@ func SearchTeam(ctx *context.Context) {
return
}
- apiTeams, err := convert.ToTeams(teams, false)
+ apiTeams, err := convert.ToTeams(ctx, teams, false)
if err != nil {
log.Error("convert ToTeams failed: %v", err)
ctx.JSON(http.StatusInternalServerError, map[string]interface{}{
diff --git a/routers/web/repo/blame.go b/routers/web/repo/blame.go
index 2380a95e34..3546334ed6 100644
--- a/routers/web/repo/blame.go
+++ b/routers/web/repo/blame.go
@@ -199,7 +199,7 @@ func processBlameParts(ctx *context.Context, blameParts []git.BlamePart) (map[st
}
// populate commit email addresses to later look up avatars.
- for _, c := range user_model.ValidateCommitsWithEmails(commits) {
+ for _, c := range user_model.ValidateCommitsWithEmails(ctx, commits) {
commitNames[c.ID.String()] = c
}
@@ -262,9 +262,9 @@ func renderBlame(ctx *context.Context, blameParts []git.BlamePart, commitNames m
var avatar string
if commit.User != nil {
- avatar = string(templates.Avatar(commit.User, 18, "gt-mr-3"))
+ avatar = string(templates.Avatar(ctx, commit.User, 18, "gt-mr-3"))
} else {
- avatar = string(templates.AvatarByEmail(commit.Author.Email, commit.Author.Name, 18, "gt-mr-3"))
+ avatar = string(templates.AvatarByEmail(ctx, commit.Author.Email, commit.Author.Name, 18, "gt-mr-3"))
}
br.Avatar = gotemplate.HTML(avatar)
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go
index 9f94159d0d..843b1d8dfd 100644
--- a/routers/web/repo/commit.go
+++ b/routers/web/repo/commit.go
@@ -138,7 +138,7 @@ func Graph(ctx *context.Context) {
return
}
- if err := graph.LoadAndProcessCommits(ctx.Repo.Repository, ctx.Repo.GitRepo); err != nil {
+ if err := graph.LoadAndProcessCommits(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo); err != nil {
ctx.ServerError("LoadAndProcessCommits", err)
return
}
@@ -343,9 +343,9 @@ func Diff(ctx *context.Context) {
ctx.Data["CommitStatus"] = git_model.CalcCommitStatus(statuses)
ctx.Data["CommitStatuses"] = statuses
- verification := asymkey_model.ParseCommitWithSignature(commit)
+ verification := asymkey_model.ParseCommitWithSignature(ctx, commit)
ctx.Data["Verification"] = verification
- ctx.Data["Author"] = user_model.ValidateCommitWithEmail(commit)
+ ctx.Data["Author"] = user_model.ValidateCommitWithEmail(ctx, commit)
ctx.Data["Parents"] = parents
ctx.Data["DiffNotAvailable"] = diff.NumFiles == 0
@@ -361,7 +361,7 @@ func Diff(ctx *context.Context) {
if err == nil {
ctx.Data["Note"] = string(charset.ToUTF8WithFallback(note.Message))
ctx.Data["NoteCommit"] = note.Commit
- ctx.Data["NoteAuthor"] = user_model.ValidateCommitWithEmail(note.Commit)
+ ctx.Data["NoteAuthor"] = user_model.ValidateCommitWithEmail(ctx, note.Commit)
}
ctx.Data["BranchName"], err = commit.GetBranchName()
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index 3cd29c2b6d..4d799c24b8 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -3272,5 +3272,5 @@ func handleTeamMentions(ctx *context.Context) {
ctx.Data["MentionableTeams"] = teams
ctx.Data["MentionableTeamsOrg"] = ctx.Repo.Owner.Name
- ctx.Data["MentionableTeamsOrgAvatar"] = ctx.Repo.Owner.AvatarLink()
+ ctx.Data["MentionableTeamsOrgAvatar"] = ctx.Repo.Owner.AvatarLink(ctx)
}
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 8f2213a68c..99043e3ee7 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -811,7 +811,7 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri
ctx.Data["LatestCommit"] = latestCommit
if latestCommit != nil {
- verification := asymkey_model.ParseCommitWithSignature(latestCommit)
+ verification := asymkey_model.ParseCommitWithSignature(ctx, latestCommit)
if err := asymkey_model.CalculateTrustStatus(verification, ctx.Repo.Repository.GetTrustModel(), func(user *user_model.User) (bool, error) {
return repo_model.IsOwnerMemberCollaborator(ctx.Repo.Repository, user.ID)
@@ -820,7 +820,7 @@ func renderDirectoryFiles(ctx *context.Context, timeout time.Duration) git.Entri
return nil
}
ctx.Data["LatestCommitVerification"] = verification
- ctx.Data["LatestCommitUser"] = user_model.ValidateCommitWithEmail(latestCommit)
+ ctx.Data["LatestCommitUser"] = user_model.ValidateCommitWithEmail(ctx, latestCommit)
statuses, _, err := git_model.GetLatestCommitStatus(ctx, ctx.Repo.Repository.ID, latestCommit.ID.String(), db.ListOptions{})
if err != nil {
diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go
index d3826c3f3d..d27d0f1bf0 100644
--- a/routers/web/repo/webhook.go
+++ b/routers/web/repo/webhook.go
@@ -660,7 +660,7 @@ func TestWebhook(ctx *context.Context) {
}
}
- apiUser := convert.ToUserWithAccessMode(ctx.Doer, perm.AccessModeNone)
+ apiUser := convert.ToUserWithAccessMode(ctx, ctx.Doer, perm.AccessModeNone)
apiCommit := &api.PayloadCommit{
ID: commit.ID.String(),
diff --git a/routers/web/user/avatar.go b/routers/web/user/avatar.go
index 20c2ef3e47..2dba74822e 100644
--- a/routers/web/user/avatar.go
+++ b/routers/web/user/avatar.go
@@ -41,7 +41,7 @@ func AvatarByUserName(ctx *context.Context) {
user = user_model.NewGhostUser()
}
- cacheableRedirect(ctx, user.AvatarLinkWithSize(size))
+ cacheableRedirect(ctx, user.AvatarLinkWithSize(ctx, size))
}
// AvatarByEmailHash redirects the browser to the email avatar link
@@ -53,5 +53,5 @@ func AvatarByEmailHash(ctx *context.Context) {
return
}
size := ctx.FormInt("size")
- cacheableRedirect(ctx, avatars.GenerateEmailAvatarFinalLink(email, size))
+ cacheableRedirect(ctx, avatars.GenerateEmailAvatarFinalLink(ctx, email, size))
}
diff --git a/routers/web/user/search.go b/routers/web/user/search.go
index f9b0e07358..c5c3aa75f0 100644
--- a/routers/web/user/search.go
+++ b/routers/web/user/search.go
@@ -38,6 +38,6 @@ func Search(ctx *context.Context) {
ctx.JSON(http.StatusOK, map[string]interface{}{
"ok": true,
- "data": convert.ToUsers(ctx.Doer, users),
+ "data": convert.ToUsers(ctx, ctx.Doer, users),
})
}
diff --git a/routers/web/webfinger.go b/routers/web/webfinger.go
index 935832aa1f..a8e816d7b7 100644
--- a/routers/web/webfinger.go
+++ b/routers/web/webfinger.go
@@ -60,7 +60,7 @@ func WebfingerQuery(ctx *context.Context) {
u, err = user_model.GetUserByName(ctx, parts[0])
case "mailto":
- u, err = user_model.GetUserByEmailContext(ctx, resource.Opaque)
+ u, err = user_model.GetUserByEmail(ctx, resource.Opaque)
if u != nil && u.KeepEmailPrivate {
err = user_model.ErrUserNotExist{}
}
@@ -99,7 +99,7 @@ func WebfingerQuery(ctx *context.Context) {
},
{
Rel: "http://webfinger.net/rel/avatar",
- Href: u.AvatarLink(),
+ Href: u.AvatarLink(ctx),
},
{
Rel: "self",