summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-18 17:45:08 +0900
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-30 23:55:09 +0900
commit20a07d26ff4be9c82271297e516df912109b05aa (patch)
tree2447be0ae059fc48964c62dfff80ce88a9681615 /lib
parent17b9128b305aefc29fddae3b51d13c61ae7dfef9 (diff)
downloadgitlab-ce-20a07d26ff4be9c82271297e516df912109b05aa.tar.gz
Include owner for pipeline_schedules. Improve N+1 spec. Use PipelineBasic for small payload.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb2
-rw-r--r--lib/api/pipeline_schedules.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index b2bc0a17142..f0260cf03f3 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -690,7 +690,7 @@ module API
expose :id
expose :description, :ref, :cron, :cron_timezone, :next_run_at, :active
expose :created_at, :updated_at, :deleted_at
- expose :last_pipeline, using: Entities::Pipeline
+ expose :last_pipeline, using: Entities::PipelineBasic
expose :owner, using: Entities::UserBasic
end
diff --git a/lib/api/pipeline_schedules.rb b/lib/api/pipeline_schedules.rb
index 27be796356c..c6c22f6e518 100644
--- a/lib/api/pipeline_schedules.rb
+++ b/lib/api/pipeline_schedules.rb
@@ -17,7 +17,7 @@ module API
get ':id/pipeline_schedules' do
authorize! :read_pipeline_schedule, user_project
- pipeline_schedules = user_project.pipeline_schedules.includes(last_pipeline: {statuses: :latest})
+ pipeline_schedules = user_project.pipeline_schedules.includes([:owner, last_pipeline: {statuses: :latest}])
present paginate(pipeline_schedules), with: Entities::PipelineSchedule
end