diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-03-22 08:03:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-22 15:03:22 +0800 |
commit | 80fd25524e13dedbdc3527b32d008de152213a89 (patch) | |
tree | 63b2bfe4ffaf1dce12080cabdc2e845c8731a673 /routers/api/v1/admin | |
parent | 5495ba7660979973ba19e304786135da474e0e64 (diff) | |
download | gitea-80fd25524e13dedbdc3527b32d008de152213a89.tar.gz gitea-80fd25524e13dedbdc3527b32d008de152213a89.zip |
Renamed ctx.User to ctx.Doer. (#19161)
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/api/v1/admin')
-rw-r--r-- | routers/api/v1/admin/adopt.go | 4 | ||||
-rw-r--r-- | routers/api/v1/admin/cron.go | 2 | ||||
-rw-r--r-- | routers/api/v1/admin/org.go | 2 | ||||
-rw-r--r-- | routers/api/v1/admin/user.go | 16 |
4 files changed, 12 insertions, 12 deletions
diff --git a/routers/api/v1/admin/adopt.go b/routers/api/v1/admin/adopt.go index db1754c8d0..3c39d7c2bc 100644 --- a/routers/api/v1/admin/adopt.go +++ b/routers/api/v1/admin/adopt.go @@ -110,7 +110,7 @@ func AdoptRepository(ctx *context.APIContext) { ctx.NotFound() return } - if _, err := repo_service.AdoptRepository(ctx.User, ctxUser, models.CreateRepoOptions{ + if _, err := repo_service.AdoptRepository(ctx.Doer, ctxUser, models.CreateRepoOptions{ Name: repoName, IsPrivate: true, }); err != nil { @@ -173,7 +173,7 @@ func DeleteUnadoptedRepository(ctx *context.APIContext) { return } - if err := repo_service.DeleteUnadoptedRepository(ctx.User, ctxUser, repoName); err != nil { + if err := repo_service.DeleteUnadoptedRepository(ctx.Doer, ctxUser, repoName); err != nil { ctx.InternalServerError(err) return } diff --git a/routers/api/v1/admin/cron.go b/routers/api/v1/admin/cron.go index 1476872a90..0c4333b892 100644 --- a/routers/api/v1/admin/cron.go +++ b/routers/api/v1/admin/cron.go @@ -81,7 +81,7 @@ func PostCronTask(ctx *context.APIContext) { return } task.Run() - log.Trace("Cron Task %s started by admin(%s)", task.Name, ctx.User.Name) + log.Trace("Cron Task %s started by admin(%s)", task.Name, ctx.Doer.Name) ctx.Status(http.StatusNoContent) } diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go index aaa27afb9e..4ebfe9863c 100644 --- a/routers/api/v1/admin/org.go +++ b/routers/api/v1/admin/org.go @@ -107,7 +107,7 @@ func GetAllOrgs(ctx *context.APIContext) { listOptions := utils.GetListOptions(ctx) users, maxResults, err := user_model.SearchUsers(&user_model.SearchUserOptions{ - Actor: ctx.User, + Actor: ctx.Doer, Type: user_model.UserTypeOrganization, OrderBy: db.SearchOrderByAlphabetically, ListOptions: listOptions, diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index 1d3854df9b..677950664d 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -128,13 +128,13 @@ func CreateUser(ctx *context.APIContext) { } return } - log.Trace("Account created by admin (%s): %s", ctx.User.Name, u.Name) + log.Trace("Account created by admin (%s): %s", ctx.Doer.Name, u.Name) // Send email notification. if form.SendNotify { mailer.SendRegisterNotifyMail(u) } - ctx.JSON(http.StatusCreated, convert.ToUser(u, ctx.User)) + ctx.JSON(http.StatusCreated, convert.ToUser(u, ctx.Doer)) } // EditUser api for modifying a user's information @@ -275,9 +275,9 @@ func EditUser(ctx *context.APIContext) { } return } - log.Trace("Account profile updated by admin (%s): %s", ctx.User.Name, u.Name) + log.Trace("Account profile updated by admin (%s): %s", ctx.Doer.Name, u.Name) - ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.User)) + ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.Doer)) } // DeleteUser api for deleting a user @@ -320,7 +320,7 @@ func DeleteUser(ctx *context.APIContext) { } return } - log.Trace("Account deleted by admin(%s): %s", ctx.User.Name, u.Name) + log.Trace("Account deleted by admin(%s): %s", ctx.Doer.Name, u.Name) ctx.Status(http.StatusNoContent) } @@ -401,7 +401,7 @@ func DeleteUserPublicKey(ctx *context.APIContext) { } return } - log.Trace("Key deleted by admin(%s): %s", ctx.User.Name, u.Name) + log.Trace("Key deleted by admin(%s): %s", ctx.Doer.Name, u.Name) ctx.Status(http.StatusNoContent) } @@ -431,7 +431,7 @@ func GetAllUsers(ctx *context.APIContext) { listOptions := utils.GetListOptions(ctx) users, maxResults, err := user_model.SearchUsers(&user_model.SearchUserOptions{ - Actor: ctx.User, + Actor: ctx.Doer, Type: user_model.UserTypeIndividual, OrderBy: db.SearchOrderByAlphabetically, ListOptions: listOptions, @@ -443,7 +443,7 @@ func GetAllUsers(ctx *context.APIContext) { results := make([]*api.User, len(users)) for i := range users { - results[i] = convert.ToUser(users[i], ctx.User) + results[i] = convert.ToUser(users[i], ctx.Doer) } ctx.SetLinkHeader(int(maxResults), listOptions.PageSize) |