diff options
Diffstat (limited to 'routers/api/v1/repo/collaborators.go')
-rw-r--r-- | routers/api/v1/repo/collaborators.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go index 078af1f6ff..d636220f62 100644 --- a/routers/api/v1/repo/collaborators.go +++ b/routers/api/v1/repo/collaborators.go @@ -47,15 +47,24 @@ func ListCollaborators(ctx *context.APIContext) { // "200": // "$ref": "#/responses/UserList" + count, err := ctx.Repo.Repository.CountCollaborators() + if err != nil { + ctx.InternalServerError(err) + return + } + collaborators, err := ctx.Repo.Repository.GetCollaborators(utils.GetListOptions(ctx)) if err != nil { ctx.Error(http.StatusInternalServerError, "ListCollaborators", err) return } + users := make([]*api.User, len(collaborators)) for i, collaborator := range collaborators { users[i] = convert.ToUser(collaborator.User, ctx.User) } + + ctx.SetTotalCountHeader(count) ctx.JSON(http.StatusOK, users) } |