diff options
author | Stephan van Leeuwen <stephan.vanleeuwen5@gmail.com> | 2014-12-21 13:35:11 +0100 |
---|---|---|
committer | Stephan van Leeuwen <stephan.vanleeuwen5@gmail.com> | 2015-03-24 19:11:48 +0100 |
commit | 3b3662da0a5f31dddbe19be7f8e787c1b90b1b22 (patch) | |
tree | 160b299c7d747a1e4e8bfd1ae4d421f949b20c25 | |
parent | c3c9703437a552700c2a6ca010b05cc56aa6d73a (diff) | |
download | gitlab-ce-3b3662da0a5f31dddbe19be7f8e787c1b90b1b22.tar.gz |
Updated api method GET /projects/:id/events to use paginate instead of a self-implementation
Also updated example request url
Added changelog item
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/api/projects.rb | 7 |
2 files changed, 3 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG index 3ecc45cde07..297a8ee3489 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -33,6 +33,7 @@ v 7.10.0 (unreleased) - Don't show commit comment button when user is not signed in. - Don't include system notes in issue/MR comment count. - Don't mark merge request as updated when merge status relative to target branch changes. + - API: Add pagination to project events v 7.9.0 - Send EmailsOnPush email when branch or tag is created or deleted. diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 83f65eec6cc..e3fff79d68f 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -88,17 +88,14 @@ module API present user_project, with: Entities::ProjectWithAccess, user: current_user end - # Get a single project events + # Get events for a single project # # Parameters: # id (required) - The ID of a project # Example Request: # GET /projects/:id/events get ":id/events" do - limit = (params[:per_page] || 20).to_i - offset = (params[:page] || 0).to_i * limit - events = user_project.events.recent.limit(limit).offset(offset) - + events = paginate user_project.events.recent present events, with: Entities::Event end |