diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2022-05-20 22:08:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 22:08:52 +0800 |
commit | fd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch) | |
tree | 50038348ec10485f72344f3ac80324e04abc1283 /routers/web/org | |
parent | d81e31ad7826a81fc7139f329f250594610a274b (diff) | |
download | gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.tar.gz gitea-fd7d83ace60258acf7139c4c787aa8af75b7ba8c.zip |
Move almost all functions' parameter db.Engine to context.Context (#19748)
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
Diffstat (limited to 'routers/web/org')
-rw-r--r-- | routers/web/org/org_labels.go | 4 | ||||
-rw-r--r-- | routers/web/org/setting.go | 6 | ||||
-rw-r--r-- | routers/web/org/teams.go | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/routers/web/org/org_labels.go b/routers/web/org/org_labels.go index d79ffc597c..bfa9f162c3 100644 --- a/routers/web/org/org_labels.go +++ b/routers/web/org/org_labels.go @@ -17,7 +17,7 @@ import ( // RetrieveLabels find all the labels of an organization func RetrieveLabels(ctx *context.Context) { - labels, err := models.GetLabelsByOrgID(ctx.Org.Organization.ID, ctx.FormString("sort"), db.ListOptions{}) + labels, err := models.GetLabelsByOrgID(ctx, ctx.Org.Organization.ID, ctx.FormString("sort"), db.ListOptions{}) if err != nil { ctx.ServerError("RetrieveLabels.GetLabels", err) return @@ -59,7 +59,7 @@ func NewLabel(ctx *context.Context) { // UpdateLabel update a label's name and color func UpdateLabel(ctx *context.Context) { form := web.GetForm(ctx).(*forms.CreateLabelForm) - l, err := models.GetLabelInOrgByID(ctx.Org.Organization.ID, form.ID) + l, err := models.GetLabelInOrgByID(ctx, ctx.Org.Organization.ID, form.ID) if err != nil { switch { case models.IsErrOrgLabelNotExist(err): diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 5cd245ef09..758ca47af6 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -66,7 +66,7 @@ func SettingsPost(ctx *context.Context) { // Check if organization name has been changed. if org.LowerName != strings.ToLower(form.Name) { - isExist, err := user_model.IsUserExist(org.ID, form.Name) + isExist, err := user_model.IsUserExist(ctx, org.ID, form.Name) if err != nil { ctx.ServerError("IsUserExist", err) return @@ -110,7 +110,7 @@ func SettingsPost(ctx *context.Context) { visibilityChanged := form.Visibility != org.Visibility org.Visibility = form.Visibility - if err := user_model.UpdateUser(org.AsUser(), false); err != nil { + if err := user_model.UpdateUser(ctx, org.AsUser(), false); err != nil { ctx.ServerError("UpdateUser", err) return } @@ -207,7 +207,7 @@ func Webhooks(ctx *context.Context) { ctx.Data["BaseLinkNew"] = ctx.Org.OrgLink + "/settings/hooks" ctx.Data["Description"] = ctx.Tr("org.settings.hooks_desc") - ws, err := webhook.ListWebhooksByOpts(&webhook.ListWebhookOptions{OrgID: ctx.Org.Organization.ID}) + ws, err := webhook.ListWebhooksByOpts(ctx, &webhook.ListWebhookOptions{OrgID: ctx.Org.Organization.ID}) if err != nil { ctx.ServerError("GetWebhooksByOrgId", err) return diff --git a/routers/web/org/teams.go b/routers/web/org/teams.go index 3689ffe93d..284fb096f3 100644 --- a/routers/web/org/teams.go +++ b/routers/web/org/teams.go @@ -122,7 +122,7 @@ func TeamsAction(ctx *context.Context) { } uname := utils.RemoveUsernameParameterSuffix(strings.ToLower(ctx.FormString("uname"))) var u *user_model.User - u, err = user_model.GetUserByName(uname) + u, err = user_model.GetUserByName(ctx, uname) if err != nil { if user_model.IsErrUserNotExist(err) { ctx.Flash.Error(ctx.Tr("form.user_not_exist")) |