Commit 3b3662da authored by Stephan van Leeuwen's avatar Stephan van Leeuwen

Updated api method GET /projects/:id/events to use paginate instead of a self-implementation

Also updated example request url

Added changelog item
parent c3c97034
......@@ -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.
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment