diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-07-22 22:14:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-22 22:14:27 +0800 |
commit | b167f35113e643ccdb17a2dde55bdec5960b284b (patch) | |
tree | 99a6e53bf1a9d4c9199c19113650cc48a8c1fd0e /routers/api/v1/repo/issue_label.go | |
parent | c42b71877edb4830b9573101d20853222d66fb3c (diff) | |
download | gitea-b167f35113e643ccdb17a2dde55bdec5960b284b.tar.gz gitea-b167f35113e643ccdb17a2dde55bdec5960b284b.zip |
Add context parameter to some database functions (#26055)
To avoid deadlock problem, almost database related functions should be
have ctx as the first parameter.
This PR do a refactor for some of these functions.
Diffstat (limited to 'routers/api/v1/repo/issue_label.go')
-rw-r--r-- | routers/api/v1/repo/issue_label.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/repo/issue_label.go b/routers/api/v1/repo/issue_label.go index 9d43c66d8c..fc83b6f14c 100644 --- a/routers/api/v1/repo/issue_label.go +++ b/routers/api/v1/repo/issue_label.go @@ -45,7 +45,7 @@ func ListIssueLabels(ctx *context.APIContext) { // "404": // "$ref": "#/responses/notFound" - issue, err := issues_model.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) + issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if issues_model.IsErrIssueNotExist(err) { ctx.NotFound() @@ -157,7 +157,7 @@ func DeleteIssueLabel(ctx *context.APIContext) { // "422": // "$ref": "#/responses/validationError" - issue, err := issues_model.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) + issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if issues_model.IsErrIssueNotExist(err) { ctx.NotFound() @@ -275,7 +275,7 @@ func ClearIssueLabels(ctx *context.APIContext) { // "403": // "$ref": "#/responses/forbidden" - issue, err := issues_model.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) + issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if issues_model.IsErrIssueNotExist(err) { ctx.NotFound() @@ -299,7 +299,7 @@ func ClearIssueLabels(ctx *context.APIContext) { } func prepareForReplaceOrAdd(ctx *context.APIContext, form api.IssueLabelsOption) (*issues_model.Issue, []*issues_model.Label, error) { - issue, err := issues_model.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) + issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { if issues_model.IsErrIssueNotExist(err) { ctx.NotFound() |