forked from forgejo/forgejo
Renamed ctx.User to ctx.Doer. (#19161)
Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
5495ba7660
commit
80fd25524e
129 changed files with 881 additions and 881 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue