diff options
Diffstat (limited to 'routers/web')
-rw-r--r-- | routers/web/auth/auth.go | 10 | ||||
-rw-r--r-- | routers/web/auth/oauth.go | 5 | ||||
-rw-r--r-- | routers/web/auth/password.go | 5 | ||||
-rw-r--r-- | routers/web/org/org_labels.go | 2 | ||||
-rw-r--r-- | routers/web/repo/compare.go | 3 | ||||
-rw-r--r-- | routers/web/repo/http.go | 3 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 2 | ||||
-rw-r--r-- | routers/web/repo/issue_content_history.go | 11 | ||||
-rw-r--r-- | routers/web/repo/issue_label.go | 2 | ||||
-rw-r--r-- | routers/web/repo/pull.go | 4 | ||||
-rw-r--r-- | routers/web/repo/repo.go | 8 | ||||
-rw-r--r-- | routers/web/repo/setting.go | 6 | ||||
-rw-r--r-- | routers/web/repo/view.go | 4 | ||||
-rw-r--r-- | routers/web/repo/webhook.go | 23 | ||||
-rw-r--r-- | routers/web/user/home.go | 4 | ||||
-rw-r--r-- | routers/web/user/setting/account.go | 3 | ||||
-rw-r--r-- | routers/web/user/setting/keys.go | 2 | ||||
-rw-r--r-- | routers/web/user/setting/profile.go | 2 |
18 files changed, 46 insertions, 53 deletions
diff --git a/routers/web/auth/auth.go b/routers/web/auth/auth.go index 556fd26d01..ab538f0e5f 100644 --- a/routers/web/auth/auth.go +++ b/routers/web/auth/auth.go @@ -107,7 +107,7 @@ func resetLocale(ctx *context.Context, u *user_model.User) error { // If the user does not have a locale set, we save the current one. if len(u.Language) == 0 { u.Language = ctx.Locale.Language() - if err := user_model.UpdateUserCols(db.DefaultContext, u, "language"); err != nil { + if err := user_model.UpdateUserCols(ctx, u, "language"); err != nil { return err } } @@ -333,7 +333,7 @@ func handleSignInFull(ctx *context.Context, u *user_model.User, remember, obeyRe // If the user does not have a locale set, we save the current one. if len(u.Language) == 0 { u.Language = ctx.Locale.Language() - if err := user_model.UpdateUserCols(db.DefaultContext, u, "language"); err != nil { + if err := user_model.UpdateUserCols(ctx, u, "language"); err != nil { ctx.ServerError("UpdateUserCols Language", fmt.Errorf("Error updating user language [user: %d, locale: %s]", u.ID, u.Language)) return setting.AppSubURL + "/" } @@ -350,7 +350,7 @@ func handleSignInFull(ctx *context.Context, u *user_model.User, remember, obeyRe // Register last login u.SetLastLogin() - if err := user_model.UpdateUserCols(db.DefaultContext, u, "last_login_unix"); err != nil { + if err := user_model.UpdateUserCols(ctx, u, "last_login_unix"); err != nil { ctx.ServerError("UpdateUserCols", err) return setting.AppSubURL + "/" } @@ -606,7 +606,7 @@ func handleUserCreated(ctx *context.Context, u *user_model.User, gothUser *goth. u.IsAdmin = true u.IsActive = true u.SetLastLogin() - if err := user_model.UpdateUserCols(db.DefaultContext, u, "is_admin", "is_active", "last_login_unix"); err != nil { + if err := user_model.UpdateUserCols(ctx, u, "is_admin", "is_active", "last_login_unix"); err != nil { ctx.ServerError("UpdateUser", err) return } @@ -733,7 +733,7 @@ func handleAccountActivation(ctx *context.Context, user *user_model.User) { ctx.ServerError("UpdateUser", err) return } - if err := user_model.UpdateUserCols(db.DefaultContext, user, "is_active", "rands"); err != nil { + if err := user_model.UpdateUserCols(ctx, user, "is_active", "rands"); err != nil { if user_model.IsErrUserNotExist(err) { ctx.NotFound("UpdateUserCols", err) } else { diff --git a/routers/web/auth/oauth.go b/routers/web/auth/oauth.go index 83b58d6cbf..847af52bdb 100644 --- a/routers/web/auth/oauth.go +++ b/routers/web/auth/oauth.go @@ -16,7 +16,6 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" @@ -1021,7 +1020,7 @@ func handleOAuth2SignIn(ctx *context.Context, source *auth.Source, u *user_model cols = append(cols, "is_admin", "is_restricted") } - if err := user_model.UpdateUserCols(db.DefaultContext, u, cols...); err != nil { + if err := user_model.UpdateUserCols(ctx, u, cols...); err != nil { ctx.ServerError("UpdateUserCols", err) return } @@ -1048,7 +1047,7 @@ func handleOAuth2SignIn(ctx *context.Context, source *auth.Source, u *user_model changed := setUserGroupClaims(source, u, &gothUser) if changed { - if err := user_model.UpdateUserCols(db.DefaultContext, u, "is_admin", "is_restricted"); err != nil { + if err := user_model.UpdateUserCols(ctx, u, "is_admin", "is_restricted"); err != nil { ctx.ServerError("UpdateUserCols", err) return } diff --git a/routers/web/auth/password.go b/routers/web/auth/password.go index 8e309ebb1a..d7bf67cffb 100644 --- a/routers/web/auth/password.go +++ b/routers/web/auth/password.go @@ -9,7 +9,6 @@ import ( "net/http" "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" @@ -232,7 +231,7 @@ func ResetPasswdPost(ctx *context.Context) { return } u.MustChangePassword = false - if err := user_model.UpdateUserCols(db.DefaultContext, u, "must_change_password", "passwd", "passwd_hash_algo", "rands", "salt"); err != nil { + if err := user_model.UpdateUserCols(ctx, u, "must_change_password", "passwd", "passwd_hash_algo", "rands", "salt"); err != nil { ctx.ServerError("UpdateUser", err) return } @@ -327,7 +326,7 @@ func MustChangePasswordPost(ctx *context.Context) { u.MustChangePassword = false - if err := user_model.UpdateUserCols(db.DefaultContext, u, "must_change_password", "passwd", "passwd_hash_algo", "salt"); err != nil { + if err := user_model.UpdateUserCols(ctx, u, "must_change_password", "passwd", "passwd_hash_algo", "salt"); err != nil { ctx.ServerError("UpdateUser", err) return } diff --git a/routers/web/org/org_labels.go b/routers/web/org/org_labels.go index 9cc9a92507..0ec6c3ce3b 100644 --- a/routers/web/org/org_labels.go +++ b/routers/web/org/org_labels.go @@ -100,7 +100,7 @@ func InitializeLabels(ctx *context.Context) { return } - if err := models.InitializeLabels(db.DefaultContext, ctx.Org.Organization.ID, form.TemplateName, true); err != nil { + if err := models.InitializeLabels(ctx, ctx.Org.Organization.ID, form.TemplateName, true); err != nil { if models.IsErrIssueLabelTemplateLoad(err) { originalErr := err.(models.ErrIssueLabelTemplateLoad).OriginalError ctx.Flash.Error(ctx.Tr("repo.issues.label_templates.fail_to_load_file", form.TemplateName, originalErr)) diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index c2ae86d5d0..23ec662cfa 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -18,7 +18,6 @@ import ( "strings" "code.gitea.io/gitea/models" - "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unit" user_model "code.gitea.io/gitea/models/user" @@ -269,7 +268,7 @@ func ParseCompareInfo(ctx *context.Context) *CompareInfo { } return nil } - if err := ci.HeadRepo.GetOwner(db.DefaultContext); err != nil { + if err := ci.HeadRepo.GetOwner(ctx); err != nil { if user_model.IsErrUserNotExist(err) { ctx.NotFound("GetUserByName", nil) } else { diff --git a/routers/web/repo/http.go b/routers/web/repo/http.go index b706330d6d..0207cd7685 100644 --- a/routers/web/repo/http.go +++ b/routers/web/repo/http.go @@ -21,7 +21,6 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/perm" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unit" @@ -159,7 +158,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) { // don't allow anonymous pulls if organization is not public if isPublicPull { - if err := repo.GetOwner(db.DefaultContext); err != nil { + if err := repo.GetOwner(ctx); err != nil { ctx.ServerError("GetOwner", err) return } diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 18f352265f..e51631a721 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1944,7 +1944,7 @@ func UpdatePullReviewRequest(ctx *context.Context) { } if reviewID < 0 { // negative reviewIDs represent team requests - if err := issue.Repo.GetOwner(db.DefaultContext); err != nil { + if err := issue.Repo.GetOwner(ctx); err != nil { ctx.ServerError("issue.Repo.GetOwner", err) return } diff --git a/routers/web/repo/issue_content_history.go b/routers/web/repo/issue_content_history.go index 0d3b236689..21b22aa710 100644 --- a/routers/web/repo/issue_content_history.go +++ b/routers/web/repo/issue_content_history.go @@ -12,7 +12,6 @@ import ( "strings" "code.gitea.io/gitea/models" - "code.gitea.io/gitea/models/db" issuesModel "code.gitea.io/gitea/models/issues" "code.gitea.io/gitea/models/unit" "code.gitea.io/gitea/modules/context" @@ -32,7 +31,7 @@ func GetContentHistoryOverview(ctx *context.Context) { } lang := ctx.Locale.Language() - editedHistoryCountMap, _ := issuesModel.QueryIssueContentHistoryEditedCountMap(db.DefaultContext, issue.ID) + editedHistoryCountMap, _ := issuesModel.QueryIssueContentHistoryEditedCountMap(ctx, issue.ID) ctx.JSON(http.StatusOK, map[string]interface{}{ "i18n": map[string]interface{}{ "textEdited": i18n.Tr(lang, "repo.issues.content_history.edited"), @@ -52,7 +51,7 @@ func GetContentHistoryList(ctx *context.Context) { return } - items, _ := issuesModel.FetchIssueContentHistoryList(db.DefaultContext, issue.ID, commentID) + items, _ := issuesModel.FetchIssueContentHistoryList(ctx, issue.ID, commentID) // render history list to HTML for frontend dropdown items: (name, value) // name is HTML of "avatar + userName + userAction + timeSince" @@ -119,7 +118,7 @@ func GetContentHistoryDetail(ctx *context.Context) { } historyID := ctx.FormInt64("history_id") - history, prevHistory, err := issuesModel.GetIssueContentHistoryAndPrev(db.DefaultContext, historyID) + history, prevHistory, err := issuesModel.GetIssueContentHistoryAndPrev(ctx, historyID) if err != nil { ctx.JSON(http.StatusNotFound, map[string]interface{}{ "message": "Can not find the content history", @@ -196,7 +195,7 @@ func SoftDeleteContentHistory(ctx *context.Context) { return } } - if history, err = issuesModel.GetIssueContentHistoryByID(db.DefaultContext, historyID); err != nil { + if history, err = issuesModel.GetIssueContentHistoryByID(ctx, historyID); err != nil { log.Error("can not get issue content history %v. err=%v", historyID, err) return } @@ -209,7 +208,7 @@ func SoftDeleteContentHistory(ctx *context.Context) { return } - err = issuesModel.SoftDeleteIssueContentHistory(db.DefaultContext, historyID) + err = issuesModel.SoftDeleteIssueContentHistory(ctx, historyID) log.Debug("soft delete issue content history. issue=%d, comment=%d, history=%d", issue.ID, commentID, historyID) ctx.JSON(http.StatusOK, map[string]interface{}{ "ok": err == nil, diff --git a/routers/web/repo/issue_label.go b/routers/web/repo/issue_label.go index d1470910d4..ec04fa1660 100644 --- a/routers/web/repo/issue_label.go +++ b/routers/web/repo/issue_label.go @@ -39,7 +39,7 @@ func InitializeLabels(ctx *context.Context) { return } - if err := models.InitializeLabels(db.DefaultContext, ctx.Repo.Repository.ID, form.TemplateName, false); err != nil { + if err := models.InitializeLabels(ctx, ctx.Repo.Repository.ID, form.TemplateName, false); err != nil { if models.IsErrIssueLabelTemplateLoad(err) { originalErr := err.(models.ErrIssueLabelTemplateLoad).OriginalError ctx.Flash.Error(ctx.Tr("repo.issues.label_templates.fail_to_load_file", form.TemplateName, originalErr)) diff --git a/routers/web/repo/pull.go b/routers/web/repo/pull.go index 05c1ab7451..a4edfd9ee4 100644 --- a/routers/web/repo/pull.go +++ b/routers/web/repo/pull.go @@ -99,7 +99,7 @@ func getForkRepository(ctx *context.Context) *repo_model.Repository { return nil } - if err := forkRepo.GetOwner(db.DefaultContext); err != nil { + if err := forkRepo.GetOwner(ctx); err != nil { ctx.ServerError("GetOwner", err) return nil } @@ -1255,7 +1255,7 @@ func CleanUpPullRequest(ctx *context.Context) { } else if err = pr.LoadBaseRepo(); err != nil { ctx.ServerError("LoadBaseRepo", err) return - } else if err = pr.HeadRepo.GetOwner(db.DefaultContext); err != nil { + } else if err = pr.HeadRepo.GetOwner(ctx); err != nil { ctx.ServerError("HeadRepo.GetOwner", err) return } diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index 7e08a8af00..4e07d47203 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -353,7 +353,7 @@ func RedirectDownload(ctx *context.Context) { ) tagNames := []string{vTag} curRepo := ctx.Repo.Repository - releases, err := models.GetReleasesByRepoIDAndNames(db.DefaultContext, curRepo.ID, tagNames) + releases, err := models.GetReleasesByRepoIDAndNames(ctx, curRepo.ID, tagNames) if err != nil { if repo_model.IsErrAttachmentNotExist(err) { ctx.Error(http.StatusNotFound) @@ -394,7 +394,7 @@ func Download(ctx *context.Context) { return } - archiver, err := repo_model.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) + archiver, err := repo_model.GetRepoArchiver(ctx, aReq.RepoID, aReq.Type, aReq.CommitID) if err != nil { ctx.ServerError("models.GetRepoArchiver", err) return @@ -424,7 +424,7 @@ func Download(ctx *context.Context) { return } times++ - archiver, err = repo_model.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) + archiver, err = repo_model.GetRepoArchiver(ctx, aReq.RepoID, aReq.Type, aReq.CommitID) if err != nil { ctx.ServerError("archiver_service.StartArchive", err) return @@ -480,7 +480,7 @@ func InitiateDownload(ctx *context.Context) { return } - archiver, err := repo_model.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) + archiver, err := repo_model.GetRepoArchiver(ctx, aReq.RepoID, aReq.Type, aReq.CommitID) if err != nil { ctx.ServerError("archiver_service.StartArchive", err) return diff --git a/routers/web/repo/setting.go b/routers/web/repo/setting.go index 8c8f627fad..e3a424ea41 100644 --- a/routers/web/repo/setting.go +++ b/routers/web/repo/setting.go @@ -595,7 +595,7 @@ func SettingsPost(ctx *context.Context) { ctx.Error(http.StatusNotFound) return } - if err := repo.GetOwner(db.DefaultContext); err != nil { + if err := repo.GetOwner(ctx); err != nil { ctx.ServerError("Convert Fork", err) return } @@ -1055,7 +1055,7 @@ func DeployKeys(ctx *context.Context) { ctx.Data["PageIsSettingsKeys"] = true ctx.Data["DisableSSH"] = setting.SSH.Disabled - keys, err := asymkey_model.ListDeployKeys(db.DefaultContext, &asymkey_model.ListDeployKeysOptions{RepoID: ctx.Repo.Repository.ID}) + keys, err := asymkey_model.ListDeployKeys(ctx, &asymkey_model.ListDeployKeysOptions{RepoID: ctx.Repo.Repository.ID}) if err != nil { ctx.ServerError("ListDeployKeys", err) return @@ -1071,7 +1071,7 @@ func DeployKeysPost(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys") ctx.Data["PageIsSettingsKeys"] = true - keys, err := asymkey_model.ListDeployKeys(db.DefaultContext, &asymkey_model.ListDeployKeysOptions{RepoID: ctx.Repo.Repository.ID}) + keys, err := asymkey_model.ListDeployKeys(ctx, &asymkey_model.ListDeployKeysOptions{RepoID: ctx.Repo.Repository.ID}) if err != nil { ctx.ServerError("ListDeployKeys", err) return diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index 3bdcefa4c4..7fc178cf31 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -884,7 +884,7 @@ func renderCode(ctx *context.Context) { ctx.ServerError("UpdateRepositoryCols", err) return } - if err = models.UpdateRepoSize(db.DefaultContext, ctx.Repo.Repository); err != nil { + if err = models.UpdateRepoSize(ctx, ctx.Repo.Repository); err != nil { ctx.ServerError("UpdateRepoSize", err) return } @@ -1017,7 +1017,7 @@ func Forks(ctx *context.Context) { } for _, fork := range forks { - if err = fork.GetOwner(db.DefaultContext); err != nil { + if err = fork.GetOwner(ctx); err != nil { ctx.ServerError("GetOwner", err) return } diff --git a/routers/web/repo/webhook.go b/routers/web/repo/webhook.go index d457bcb190..7ffea1724a 100644 --- a/routers/web/repo/webhook.go +++ b/routers/web/repo/webhook.go @@ -13,7 +13,6 @@ import ( "path" "strings" - "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/perm" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/webhook" @@ -227,7 +226,7 @@ func GiteaHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -281,7 +280,7 @@ func newGogsWebhookPost(ctx *context.Context, form forms.NewGogshookForm, kind w if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -333,7 +332,7 @@ func DiscordHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -376,7 +375,7 @@ func DingtalkHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -428,7 +427,7 @@ func TelegramHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -483,7 +482,7 @@ func MatrixHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -526,7 +525,7 @@ func MSTeamsHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -586,7 +585,7 @@ func SlackHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -629,7 +628,7 @@ func FeishuHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -673,7 +672,7 @@ func WechatworkHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } @@ -726,7 +725,7 @@ func PackagistHooksNewPost(ctx *context.Context) { if err := w.UpdateEvent(); err != nil { ctx.ServerError("UpdateEvent", err) return - } else if err := webhook.CreateWebhook(db.DefaultContext, w); err != nil { + } else if err := webhook.CreateWebhook(ctx, w); err != nil { ctx.ServerError("CreateWebhook", err) return } diff --git a/routers/web/user/home.go b/routers/web/user/home.go index 7489f08b17..afdc344b69 100644 --- a/routers/web/user/home.go +++ b/routers/web/user/home.go @@ -74,7 +74,7 @@ func Dashboard(ctx *context.Context) { ctx.Data["Title"] = ctxUser.DisplayName() + " - " + ctx.Tr("dashboard") ctx.Data["PageIsDashboard"] = true ctx.Data["PageIsNews"] = true - cnt, _ := models.GetOrganizationCount(db.DefaultContext, ctxUser) + cnt, _ := models.GetOrganizationCount(ctx, ctxUser) ctx.Data["UserOrgsCount"] = cnt var uid int64 @@ -730,7 +730,7 @@ func ShowSSHKeys(ctx *context.Context, uid int64) { // ShowGPGKeys output all the public GPG keys of user by uid func ShowGPGKeys(ctx *context.Context, uid int64) { - keys, err := asymkey_model.ListGPGKeys(db.DefaultContext, uid, db.ListOptions{}) + keys, err := asymkey_model.ListGPGKeys(ctx, uid, db.ListOptions{}) if err != nil { ctx.ServerError("ListGPGKeys", err) return diff --git a/routers/web/user/setting/account.go b/routers/web/user/setting/account.go index 468d5ca651..a5854991a0 100644 --- a/routers/web/user/setting/account.go +++ b/routers/web/user/setting/account.go @@ -11,7 +11,6 @@ import ( "time" "code.gitea.io/gitea/models" - "code.gitea.io/gitea/models/db" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" @@ -75,7 +74,7 @@ func AccountPost(ctx *context.Context) { ctx.ServerError("UpdateUser", err) return } - if err := user_model.UpdateUserCols(db.DefaultContext, ctx.Doer, "salt", "passwd_hash_algo", "passwd"); err != nil { + if err := user_model.UpdateUserCols(ctx, ctx.Doer, "salt", "passwd_hash_algo", "passwd"); err != nil { ctx.ServerError("UpdateUser", err) return } diff --git a/routers/web/user/setting/keys.go b/routers/web/user/setting/keys.go index 2cc627ecde..a8d07ea47a 100644 --- a/routers/web/user/setting/keys.go +++ b/routers/web/user/setting/keys.go @@ -269,7 +269,7 @@ func loadKeysData(ctx *context.Context) { } ctx.Data["ExternalKeys"] = externalKeys - gpgkeys, err := asymkey_model.ListGPGKeys(db.DefaultContext, ctx.Doer.ID, db.ListOptions{}) + gpgkeys, err := asymkey_model.ListGPGKeys(ctx, ctx.Doer.ID, db.ListOptions{}) if err != nil { ctx.ServerError("ListGPGKeys", err) return diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go index 72cbf33e5f..09871ef763 100644 --- a/routers/web/user/setting/profile.go +++ b/routers/web/user/setting/profile.go @@ -185,7 +185,7 @@ func UpdateAvatarSetting(ctx *context.Context, form *forms.AvatarForm, ctxUser * } } - if err := user_model.UpdateUserCols(db.DefaultContext, ctxUser, "avatar", "avatar_email", "use_custom_avatar"); err != nil { + if err := user_model.UpdateUserCols(ctx, ctxUser, "avatar", "avatar_email", "use_custom_avatar"); err != nil { return fmt.Errorf("UpdateUser: %v", err) } |