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) ...@@ -33,6 +33,7 @@ v 7.10.0 (unreleased)
- Don't show commit comment button when user is not signed in. - Don't show commit comment button when user is not signed in.
- Don't include system notes in issue/MR comment count. - 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. - 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 v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted. - Send EmailsOnPush email when branch or tag is created or deleted.
......
...@@ -88,17 +88,14 @@ module API ...@@ -88,17 +88,14 @@ module API
present user_project, with: Entities::ProjectWithAccess, user: current_user present user_project, with: Entities::ProjectWithAccess, user: current_user
end end
# Get a single project events # Get events for a single project
# #
# Parameters: # Parameters:
# id (required) - The ID of a project # id (required) - The ID of a project
# Example Request: # Example Request:
# GET /projects/:id/events # GET /projects/:id/events
get ":id/events" do get ":id/events" do
limit = (params[:per_page] || 20).to_i events = paginate user_project.events.recent
offset = (params[:page] || 0).to_i * limit
events = user_project.events.recent.limit(limit).offset(offset)
present events, with: Entities::Event present events, with: Entities::Event
end 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