Commit 1d759895 authored by Shinya Maeda's avatar Shinya Maeda

Move conditional statement to PipelineSerializer#represent_status

parent a375d80e
......@@ -474,7 +474,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
end
def pipeline_status
render json: {} and return unless @merge_request.head_pipeline.present?
render json: PipelineSerializer
.new(project: @project, user: @current_user)
.represent_status(@merge_request.head_pipeline)
......
......@@ -24,6 +24,7 @@ class PipelineSerializer < BaseSerializer
end
def represent_status(resource)
return {} unless resource.present?
data = represent(resource, { only: [{ details: [:status] }] })
data.dig(:details, :status) || {}
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