diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /lib/api/entities | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'lib/api/entities')
-rw-r--r-- | lib/api/entities/batched_background_migration.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/broadcast_message.rb | 10 | ||||
-rw-r--r-- | lib/api/entities/ci/pipeline_basic_with_metadata.rb | 3 | ||||
-rw-r--r-- | lib/api/entities/ci/pipeline_with_metadata.rb | 3 | ||||
-rw-r--r-- | lib/api/entities/commit_status.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/group.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/group_detail.rb | 2 | ||||
-rw-r--r-- | lib/api/entities/merge_request_basic.rb | 2 | ||||
-rw-r--r-- | lib/api/entities/notification_setting.rb | 6 | ||||
-rw-r--r-- | lib/api/entities/nuget/metadatum.rb | 6 | ||||
-rw-r--r-- | lib/api/entities/project.rb | 5 | ||||
-rw-r--r-- | lib/api/entities/snippet.rb | 2 | ||||
-rw-r--r-- | lib/api/entities/system/broadcast_message.rb | 13 |
13 files changed, 32 insertions, 23 deletions
diff --git a/lib/api/entities/batched_background_migration.rb b/lib/api/entities/batched_background_migration.rb index 08e4681e0aa..65e9de4b2bd 100644 --- a/lib/api/entities/batched_background_migration.rb +++ b/lib/api/entities/batched_background_migration.rb @@ -6,6 +6,7 @@ module API expose :id, documentation: { type: :string, example: "1234" } expose :job_class_name, documentation: { type: :string, example: "CopyColumnUsingBackgroundMigrationJob" } expose :table_name, documentation: { type: :string, example: "events" } + expose :column_name, documentation: { type: :string, example: "id" } expose :status_name, as: :status, override: true, documentation: { type: :string, example: "active" } expose :progress, documentation: { type: :float, example: 50 } expose :created_at, documentation: { type: :dateTime, example: "2022-11-28T16:26:39+02:00" } diff --git a/lib/api/entities/broadcast_message.rb b/lib/api/entities/broadcast_message.rb deleted file mode 100644 index 5a31d64fd86..00000000000 --- a/lib/api/entities/broadcast_message.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -module API - module Entities - class BroadcastMessage < Grape::Entity - expose :id, :message, :starts_at, :ends_at, :color, :font, :target_access_levels, :target_path, :broadcast_type, :dismissable - expose :active?, as: :active - end - end -end diff --git a/lib/api/entities/ci/pipeline_basic_with_metadata.rb b/lib/api/entities/ci/pipeline_basic_with_metadata.rb index 4eeba3aec41..a352da05b2d 100644 --- a/lib/api/entities/ci/pipeline_basic_with_metadata.rb +++ b/lib/api/entities/ci/pipeline_basic_with_metadata.rb @@ -5,8 +5,7 @@ module API module Ci class PipelineBasicWithMetadata < PipelineBasic expose :name, - documentation: { type: 'string', example: 'Build pipeline' }, - if: ->(pipeline, _) { ::Feature.enabled?(:pipeline_name_in_api, pipeline.project) } + documentation: { type: 'string', example: 'Build pipeline' } end end end diff --git a/lib/api/entities/ci/pipeline_with_metadata.rb b/lib/api/entities/ci/pipeline_with_metadata.rb index a8b1d81a053..31604f33fc1 100644 --- a/lib/api/entities/ci/pipeline_with_metadata.rb +++ b/lib/api/entities/ci/pipeline_with_metadata.rb @@ -5,8 +5,7 @@ module API module Ci class PipelineWithMetadata < Pipeline expose :name, - documentation: { type: 'string', example: 'Build pipeline' }, - if: ->(pipeline, _) { ::Feature.enabled?(:pipeline_name_in_api, pipeline.project) } + documentation: { type: 'string', example: 'Build pipeline' } end end end diff --git a/lib/api/entities/commit_status.rb b/lib/api/entities/commit_status.rb index df6a41895ff..14ec3ba461b 100644 --- a/lib/api/entities/commit_status.rb +++ b/lib/api/entities/commit_status.rb @@ -18,6 +18,7 @@ module API expose :finished_at, documentation: { type: 'dateTime', example: '2016-01-21T08:40:25.832Z' } expose :allow_failure, documentation: { type: 'boolean', example: false } expose :coverage, documentation: { type: 'number', format: 'float', example: 98.29 } + expose :pipeline_id, documentation: { type: 'integer', example: 101 } expose :author, using: Entities::UserBasic end diff --git a/lib/api/entities/group.rb b/lib/api/entities/group.rb index 9296617dac9..d18a29ce4d4 100644 --- a/lib/api/entities/group.rb +++ b/lib/api/entities/group.rb @@ -14,6 +14,7 @@ module API expose :mentions_disabled expose :lfs_enabled?, as: :lfs_enabled expose :default_branch_protection + expose :default_branch_protection_defaults expose :avatar_url do |group, options| group.avatar_url(only_path: false) end diff --git a/lib/api/entities/group_detail.rb b/lib/api/entities/group_detail.rb index 7b05984421a..f3d64315203 100644 --- a/lib/api/entities/group_detail.rb +++ b/lib/api/entities/group_detail.rb @@ -16,7 +16,7 @@ module API projects = GroupProjectsFinder.new( group: group, current_user: options[:current_user], - options: { only_owned: true, limit: projects_limit } + options: { exclude_shared: true, limit: projects_limit } ).execute Entities::Project.prepare_relation(projects, options) diff --git a/lib/api/entities/merge_request_basic.rb b/lib/api/entities/merge_request_basic.rb index adff7f87cd3..56519e2bf08 100644 --- a/lib/api/entities/merge_request_basic.rb +++ b/lib/api/entities/merge_request_basic.rb @@ -107,8 +107,6 @@ module API end def can_check_mergeability?(project) - return true if ::Feature.disabled?(:restrict_merge_status_recheck, project) - Ability.allowed?(options[:current_user], :update_merge_request, project) end end diff --git a/lib/api/entities/notification_setting.rb b/lib/api/entities/notification_setting.rb index cdff4f2f5c5..aa6112b4402 100644 --- a/lib/api/entities/notification_setting.rb +++ b/lib/api/entities/notification_setting.rb @@ -4,9 +4,9 @@ module API module Entities class NotificationSetting < Grape::Entity expose :level - expose :events, if: ->(notification_setting, _) { notification_setting.custom? } do - ::NotificationSetting.email_events.each do |event| - expose event + expose :events, if: ->(notification_setting, _) { notification_setting.custom? } do |setting| + setting.email_events.index_with do |event_name| + setting[event_name] end end end diff --git a/lib/api/entities/nuget/metadatum.rb b/lib/api/entities/nuget/metadatum.rb index c316dfce740..1df57f8243d 100644 --- a/lib/api/entities/nuget/metadatum.rb +++ b/lib/api/entities/nuget/metadatum.rb @@ -7,8 +7,10 @@ module API expose :authors, documentation: { type: 'string', example: 'Authors' } do |metadatum| metadatum[:authors] || '' end - expose :description, as: :summary, documentation: { type: 'string', example: 'Description' } do |metadatum| - metadatum[:description] || '' + with_options documentation: { type: 'string', example: 'Description' } do + set_default = ->(metadatum) { metadatum[:description] || '' } + expose :description, &set_default + expose :description, as: :summary, &set_default end expose :project_url, as: :projectUrl, expose_nil: false, documentation: { type: 'string', example: 'http://sandbox.com/project' } expose :license_url, as: :licenseUrl, expose_nil: false, documentation: { type: 'string', example: 'http://sandbox.com/license' } diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb index 61feacd6586..0f947c85633 100644 --- a/lib/api/entities/project.rb +++ b/lib/api/entities/project.rb @@ -85,7 +85,9 @@ module API expose(:infrastructure_access_level, documentation: { type: 'string', example: 'enabled' }) { |project, options| project_feature_string_access_level(project, :infrastructure) } expose(:monitor_access_level, documentation: { type: 'string', example: 'enabled' }) { |project, options| project_feature_string_access_level(project, :monitor) } - expose :emails_disabled, documentation: { type: 'boolean' } + expose(:emails_disabled, documentation: { type: 'boolean' }) { |project, options| project.emails_disabled? } + expose :emails_enabled, documentation: { type: 'boolean' } + expose :shared_runners_enabled, documentation: { type: 'boolean' } expose :lfs_enabled?, as: :lfs_enabled, documentation: { type: 'boolean' } expose :creator_id, documentation: { type: 'integer', example: 1 } @@ -110,6 +112,7 @@ module API # CI/CD Settings expose :ci_default_git_depth, documentation: { type: 'integer', example: 20 } expose :ci_forward_deployment_enabled, documentation: { type: 'boolean' } + expose :ci_forward_deployment_rollback_allowed, documentation: { type: 'boolean' } expose(:ci_job_token_scope_enabled, documentation: { type: 'boolean' }) { |p, _| p.ci_outbound_job_token_scope_enabled? } expose :ci_separated_caches, documentation: { type: 'boolean' } expose :ci_allow_fork_pipelines_to_run_in_parent_project, documentation: { type: 'boolean' } diff --git a/lib/api/entities/snippet.rb b/lib/api/entities/snippet.rb index 709566944ed..ee652225ba0 100644 --- a/lib/api/entities/snippet.rb +++ b/lib/api/entities/snippet.rb @@ -26,3 +26,5 @@ module API end end end + +API::Entities::Snippet.prepend_mod_with('API::Entities::Snippet', with_descendants: true) diff --git a/lib/api/entities/system/broadcast_message.rb b/lib/api/entities/system/broadcast_message.rb new file mode 100644 index 00000000000..9a31095baf1 --- /dev/null +++ b/lib/api/entities/system/broadcast_message.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module API + module Entities + module System + class BroadcastMessage < Grape::Entity + expose :id, :message, :starts_at, :ends_at, :color, :font, :target_access_levels, :target_path, + :broadcast_type, :dismissable + expose :active?, as: :active + end + end + end +end |