summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/api.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-05-20 22:08:52 +0800
committerGitHub <noreply@github.com>2022-05-20 22:08:52 +0800
commitfd7d83ace60258acf7139c4c787aa8af75b7ba8c (patch)
tree50038348ec10485f72344f3ac80324e04abc1283 /routers/api/v1/api.go
parentd81e31ad7826a81fc7139f329f250594610a274b (diff)
downloadgitea-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/api/v1/api.go')
-rw-r--r--routers/api/v1/api.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 9db1d80f7f..62c4a8934c 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -108,7 +108,7 @@ func sudo() func(ctx *context.APIContext) {
if len(sudo) > 0 {
if ctx.IsSigned && ctx.Doer.IsAdmin {
- user, err := user_model.GetUserByName(sudo)
+ user, err := user_model.GetUserByName(ctx, sudo)
if err != nil {
if user_model.IsErrUserNotExist(err) {
ctx.NotFound()
@@ -143,7 +143,7 @@ func repoAssignment() func(ctx *context.APIContext) {
if ctx.IsSigned && ctx.Doer.LowerName == strings.ToLower(userName) {
owner = ctx.Doer
} else {
- owner, err = user_model.GetUserByName(userName)
+ owner, err = user_model.GetUserByName(ctx, userName)
if err != nil {
if user_model.IsErrUserNotExist(err) {
if redirectUserID, err := user_model.LookupUserRedirect(userName); err == nil {
@@ -467,7 +467,7 @@ func orgAssignment(args ...bool) func(ctx *context.APIContext) {
}
if assignTeam {
- ctx.Org.Team, err = organization.GetTeamByID(ctx.ParamsInt64(":teamid"))
+ ctx.Org.Team, err = organization.GetTeamByID(ctx, ctx.ParamsInt64(":teamid"))
if err != nil {
if organization.IsErrTeamNotExist(err) {
ctx.NotFound()