1
0
Fork 0
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:
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

@ -18,7 +18,7 @@ import (
func responseAPIUsers(ctx *context.APIContext, users []*user_model.User) {
apiUsers := make([]*api.User, len(users))
for i := range users {
apiUsers[i] = convert.ToUser(users[i], ctx.User)
apiUsers[i] = convert.ToUser(users[i], ctx.Doer)
}
ctx.JSON(http.StatusOK, &apiUsers)
}
@ -54,7 +54,7 @@ func ListMyFollowers(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/UserList"
listUserFollowers(ctx, ctx.User)
listUserFollowers(ctx, ctx.Doer)
}
// ListFollowers list the given user's followers
@ -120,7 +120,7 @@ func ListMyFollowing(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/UserList"
listUserFollowing(ctx, ctx.User)
listUserFollowing(ctx, ctx.Doer)
}
// ListFollowing list the users that the given user is following
@ -184,7 +184,7 @@ func CheckMyFollowing(ctx *context.APIContext) {
if ctx.Written() {
return
}
checkUserFollowing(ctx, ctx.User, target.ID)
checkUserFollowing(ctx, ctx.Doer, target.ID)
}
// CheckFollowing check if one user is following another user
@ -239,7 +239,7 @@ func Follow(ctx *context.APIContext) {
if ctx.Written() {
return
}
if err := user_model.FollowUser(ctx.User.ID, target.ID); err != nil {
if err := user_model.FollowUser(ctx.Doer.ID, target.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "FollowUser", err)
return
}
@ -265,7 +265,7 @@ func Unfollow(ctx *context.APIContext) {
if ctx.Written() {
return
}
if err := user_model.UnfollowUser(ctx.User.ID, target.ID); err != nil {
if err := user_model.UnfollowUser(ctx.Doer.ID, target.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "UnfollowUser", err)
return
}