Commit f42bdfa9 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'afontaine/alias-last-to-is-last' into 'master'

Add alias for last? parameter on environments page

See merge request gitlab-org/gitlab!76600
parents 38b25e5d 6059e912
......@@ -22,6 +22,8 @@ class DeploymentEntity < Grape::Entity
expose :deployed_at
expose :tag
expose :last?
expose :last?, as: :is_last
expose :deployed_by, as: :user, using: UserEntity
expose :deployable, if: -> (deployment) { deployment.deployable.present? } do |deployment, opts|
......
......@@ -4,7 +4,7 @@ class DeploymentSerializer < BaseSerializer
entity DeploymentEntity
def represent_concise(resource, opts = {})
opts[:only] = [:iid, :id, :sha, :created_at, :deployed_at, :tag, :last?, :id, ref: [:name]]
opts[:only] = [:iid, :id, :sha, :created_at, :deployed_at, :tag, :last?, :is_last, :id, ref: [:name]]
represent(resource, opts)
end
end
......@@ -7,6 +7,7 @@
"iid",
"tag",
"last?",
"is_last",
"ref",
"id"
],
......@@ -16,6 +17,7 @@
"id": { "type": "integer" },
"iid": { "type": "integer" },
"last?": { "type": "boolean" },
"is_last": { "type": "boolean" },
"ref": {
"type": "object",
"required": [
......
......@@ -42,6 +42,10 @@ RSpec.describe DeploymentEntity do
expect(subject).to include(:deployed_at)
end
it 'exposes last? as is_last' do
expect(subject).to include(:is_last)
end
context 'when deployable is nil' do
let(:entity) { described_class.new(deployment, request: request, deployment_details: false) }
let(:deployment) { create(:deployment, deployable: nil, project: project) }
......
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