diff options
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/admin/config.go | 2 | ||||
-rw-r--r-- | routers/web/auth/linkaccount.go | 2 | ||||
-rw-r--r-- | routers/web/auth/oauth.go | 4 | ||||
-rw-r--r-- | routers/web/auth/oauth_test.go | 4 | ||||
-rw-r--r-- | routers/web/auth/openid.go | 2 | ||||
-rw-r--r-- | routers/web/auth/password.go | 2 | ||||
-rw-r--r-- | routers/web/org/teams.go | 2 | ||||
-rw-r--r-- | routers/web/repo/blame.go | 6 | ||||
-rw-r--r-- | routers/web/repo/commit.go | 8 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 2 | ||||
-rw-r--r-- | routers/web/repo/view.go | 4 | ||||
-rw-r--r-- | routers/web/repo/webhook.go | 2 | ||||
-rw-r--r-- | routers/web/user/avatar.go | 4 | ||||
-rw-r--r-- | routers/web/user/search.go | 2 | ||||
-rw-r--r-- | routers/web/webfinger.go | 4 |
15 files changed, 25 insertions, 25 deletions
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", |