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/user/user.go | |
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/user/user.go')
-rw-r--r-- | routers/api/v1/user/user.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go index bba7b7a5d1..56e6ad8879 100644 --- a/routers/api/v1/user/user.go +++ b/routers/api/v1/user/user.go @@ -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 |