Commit 880cb8aa487a78c22bedb26b3cfd0e1d8590a932

Authored by Dmitriy Zaporozhets
1 parent 771b5c22

Paginate users in users api

Showing 2 changed files with 2 additions and 0 deletions   Show diff stats
doc/api/users.md
1 ## List users 1 ## List users
2 2
3 Get a list of users. 3 Get a list of users.
  4 +This function takes pagination parameters `page` and `per_page` to restrict the list of users.
4 5
5 ``` 6 ```
6 GET /users 7 GET /users
lib/api/users.rb
@@ -12,6 +12,7 @@ module Gitlab @@ -12,6 +12,7 @@ module Gitlab
12 @users = User.scoped 12 @users = User.scoped
13 @users = @users.active if params[:active].present? 13 @users = @users.active if params[:active].present?
14 @users = @users.search(params[:search]) if params[:search].present? 14 @users = @users.search(params[:search]) if params[:search].present?
  15 + @users = paginate @users
15 present @users, with: Entities::User 16 present @users, with: Entities::User
16 end 17 end
17 18