diff options
Diffstat (limited to 'app/serializers')
-rw-r--r-- | app/serializers/analytics/cycle_analytics/configuration_entity.rb | 6 | ||||
-rw-r--r-- | app/serializers/build_details_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/ci/basic_variable_entity.rb | 1 | ||||
-rw-r--r-- | app/serializers/issuable_sidebar_basic_entity.rb | 4 | ||||
-rw-r--r-- | app/serializers/issue_entity.rb | 13 | ||||
-rw-r--r-- | app/serializers/member_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/merge_request_metrics_entity.rb | 8 | ||||
-rw-r--r-- | app/serializers/merge_request_poll_widget_entity.rb | 2 | ||||
-rw-r--r-- | app/serializers/project_entity.rb | 4 |
9 files changed, 31 insertions, 11 deletions
diff --git a/app/serializers/analytics/cycle_analytics/configuration_entity.rb b/app/serializers/analytics/cycle_analytics/configuration_entity.rb index 45ea7c92758..6a9ec3f5e9e 100644 --- a/app/serializers/analytics/cycle_analytics/configuration_entity.rb +++ b/app/serializers/analytics/cycle_analytics/configuration_entity.rb @@ -11,11 +11,7 @@ module Analytics private def events - (stage_events.events - stage_events.internal_events).sort_by(&:name) - end - - def stage_events - Gitlab::Analytics::CycleAnalytics::StageEvents + Gitlab::Analytics::CycleAnalytics::StageEvents.selectable_events end end end diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index dc7b5e95361..1caa9720c08 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -11,7 +11,7 @@ class BuildDetailsEntity < Ci::JobEntity expose :metadata, using: BuildMetadataEntity expose :pipeline, using: Ci::PipelineEntity - expose :deployment_status, if: -> (*) { build.starts_environment? } do + expose :deployment_status, if: -> (*) { build.deployment_job? } do expose :deployment_status, as: :status expose :persisted_environment, as: :environment do |build, options| options.merge(deployment_details: false).yield_self do |opts| diff --git a/app/serializers/ci/basic_variable_entity.rb b/app/serializers/ci/basic_variable_entity.rb index dad59e8735b..210c01408a6 100644 --- a/app/serializers/ci/basic_variable_entity.rb +++ b/app/serializers/ci/basic_variable_entity.rb @@ -9,5 +9,6 @@ module Ci expose :protected?, as: :protected expose :masked?, as: :masked + expose :raw?, as: :raw end end diff --git a/app/serializers/issuable_sidebar_basic_entity.rb b/app/serializers/issuable_sidebar_basic_entity.rb index b66aad6cc65..9039606a8e5 100644 --- a/app/serializers/issuable_sidebar_basic_entity.rb +++ b/app/serializers/issuable_sidebar_basic_entity.rb @@ -38,6 +38,10 @@ class IssuableSidebarBasicEntity < Grape::Entity expose :can_admin_label do |issuable| can?(current_user, :admin_label, issuable.project) end + + expose :can_create_timelogs do |issuable| + can?(current_user, :create_timelog, issuable) + end end expose :issuable_json_path do |issuable| diff --git a/app/serializers/issue_entity.rb b/app/serializers/issue_entity.rb index 3d94d2e2e9d..397f333008c 100644 --- a/app/serializers/issue_entity.rb +++ b/app/serializers/issue_entity.rb @@ -7,11 +7,15 @@ class IssueEntity < IssuableEntity item.try(:upcase) end + format_with(:iso8601) do |item| + item.try(:iso8601) + end + expose :state expose :milestone_id expose :updated_by_id - expose :created_at - expose :updated_at + expose :created_at, format_with: :iso8601 + expose :updated_at, format_with: :iso8601 expose :milestone, using: API::Entities::Milestone expose :labels, using: LabelEntity expose :lock_version @@ -85,6 +89,11 @@ class IssueEntity < IssuableEntity end expose :issue_email_participants do |issue| + # TODO - This is a Temporary solution to avoid leaking participants' emails + # on public/internal projects when issue is not confidential. + # Should be removed when https://gitlab.com/gitlab-org/gitlab/-/issues/383448 is implemented. + next [] unless issue.confidential? + issue.issue_email_participants.map { |x| { email: x.email } } end diff --git a/app/serializers/member_entity.rb b/app/serializers/member_entity.rb index bfb5b3eeae6..8e5d352e413 100644 --- a/app/serializers/member_entity.rb +++ b/app/serializers/member_entity.rb @@ -23,6 +23,8 @@ class MemberEntity < Grape::Entity member.can_remove? end + expose :last_owner?, as: :is_last_owner + expose :is_direct_member do |member, options| member.source == options[:source] end diff --git a/app/serializers/merge_request_metrics_entity.rb b/app/serializers/merge_request_metrics_entity.rb index 1c9db08d103..ded82a9ef45 100644 --- a/app/serializers/merge_request_metrics_entity.rb +++ b/app/serializers/merge_request_metrics_entity.rb @@ -1,8 +1,12 @@ # frozen_string_literal: true class MergeRequestMetricsEntity < Grape::Entity - expose :latest_closed_at, as: :closed_at - expose :merged_at + format_with(:iso8601) do |item| + item.try(:iso8601) + end + + expose :latest_closed_at, as: :closed_at, format_with: :iso8601 + expose :merged_at, format_with: :iso8601 expose :latest_closed_by, as: :closed_by, using: UserEntity expose :merged_by, using: UserEntity end diff --git a/app/serializers/merge_request_poll_widget_entity.rb b/app/serializers/merge_request_poll_widget_entity.rb index ab180b35b29..cef3f4555df 100644 --- a/app/serializers/merge_request_poll_widget_entity.rb +++ b/app/serializers/merge_request_poll_widget_entity.rb @@ -31,7 +31,7 @@ class MergeRequestPollWidgetEntity < Grape::Entity end expose :only_allow_merge_if_pipeline_succeeds do |merge_request| - merge_request.project.only_allow_merge_if_pipeline_succeeds? + merge_request.project.only_allow_merge_if_pipeline_succeeds?(inherit_group_setting: true) end # CI related diff --git a/app/serializers/project_entity.rb b/app/serializers/project_entity.rb index 77e2115fbe2..cbdc19a83ce 100644 --- a/app/serializers/project_entity.rb +++ b/app/serializers/project_entity.rb @@ -13,4 +13,8 @@ class ProjectEntity < Grape::Entity expose :full_name, documentation: { type: 'string', example: 'GitLab Org / GitLab' } do |project| project.full_name end + + expose :refs_url do |project| + refs_project_path(project) + end end |