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:
KN4CK3R 2022-03-22 08:03:22 +01:00 committed by GitHub
parent 5495ba7660
commit 80fd25524e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
129 changed files with 881 additions and 881 deletions

View file

@ -56,7 +56,7 @@ func Search(ctx *context.APIContext) {
listOptions := utils.GetListOptions(ctx)
users, maxResults, err := user_model.SearchUsers(&user_model.SearchUserOptions{
Actor: ctx.User,
Actor: ctx.Doer,
Keyword: ctx.FormTrim("q"),
UID: ctx.FormInt64("uid"),
Type: user_model.UserTypeIndividual,
@ -75,7 +75,7 @@ func Search(ctx *context.APIContext) {
ctx.JSON(http.StatusOK, map[string]interface{}{
"ok": true,
"data": convert.ToUsers(ctx.User, users),
"data": convert.ToUsers(ctx.Doer, users),
})
}
@ -104,12 +104,12 @@ func GetInfo(ctx *context.APIContext) {
return
}
if !models.IsUserVisibleToViewer(u, ctx.User) {
if !models.IsUserVisibleToViewer(u, ctx.Doer) {
// fake ErrUserNotExist error message to not leak information about existence
ctx.NotFound("GetUserByName", user_model.ErrUserNotExist{Name: ctx.Params(":username")})
return
}
ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.User))
ctx.JSON(http.StatusOK, convert.ToUser(u, ctx.Doer))
}
// GetAuthenticatedUser get current user's information
@ -123,7 +123,7 @@ func GetAuthenticatedUser(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/User"
ctx.JSON(http.StatusOK, convert.ToUser(ctx.User, ctx.User))
ctx.JSON(http.StatusOK, convert.ToUser(ctx.Doer, ctx.Doer))
}
// GetUserHeatmapData is the handler to get a users heatmap
@ -150,7 +150,7 @@ func GetUserHeatmapData(ctx *context.APIContext) {
return
}
heatmap, err := models.GetUserHeatmapDataByUser(user, ctx.User)
heatmap, err := models.GetUserHeatmapDataByUser(user, ctx.Doer)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetUserHeatmapDataByUser", err)
return