diff options
Diffstat (limited to 'routers/api/v1/user/star.go')
-rw-r--r-- | routers/api/v1/user/star.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go index cc527d9213..95d3785a82 100644 --- a/routers/api/v1/user/star.go +++ b/routers/api/v1/user/star.go @@ -63,7 +63,7 @@ func GetStarredRepos(ctx *context.APIContext) { // "$ref": "#/responses/RepositoryList" user := GetUserByParams(ctx) - private := user.ID == ctx.User.ID + private := user.ID == ctx.Doer.ID repos, err := getStarredRepos(user, private, utils.GetListOptions(ctx)) if err != nil { ctx.Error(http.StatusInternalServerError, "getStarredRepos", err) @@ -94,12 +94,12 @@ func GetMyStarredRepos(ctx *context.APIContext) { // "200": // "$ref": "#/responses/RepositoryList" - repos, err := getStarredRepos(ctx.User, true, utils.GetListOptions(ctx)) + repos, err := getStarredRepos(ctx.Doer, true, utils.GetListOptions(ctx)) if err != nil { ctx.Error(http.StatusInternalServerError, "getStarredRepos", err) } - ctx.SetTotalCountHeader(int64(ctx.User.NumStars)) + ctx.SetTotalCountHeader(int64(ctx.Doer.NumStars)) ctx.JSON(http.StatusOK, &repos) } @@ -125,7 +125,7 @@ func IsStarring(ctx *context.APIContext) { // "404": // "$ref": "#/responses/notFound" - if repo_model.IsStaring(ctx.User.ID, ctx.Repo.Repository.ID) { + if repo_model.IsStaring(ctx.Doer.ID, ctx.Repo.Repository.ID) { ctx.Status(http.StatusNoContent) } else { ctx.NotFound() @@ -152,7 +152,7 @@ func Star(ctx *context.APIContext) { // "204": // "$ref": "#/responses/empty" - err := repo_model.StarRepo(ctx.User.ID, ctx.Repo.Repository.ID, true) + err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, true) if err != nil { ctx.Error(http.StatusInternalServerError, "StarRepo", err) return @@ -180,7 +180,7 @@ func Unstar(ctx *context.APIContext) { // "204": // "$ref": "#/responses/empty" - err := repo_model.StarRepo(ctx.User.ID, ctx.Repo.Repository.ID, false) + err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, false) if err != nil { ctx.Error(http.StatusInternalServerError, "StarRepo", err) return |