diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /lib/api/entities | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'lib/api/entities')
-rw-r--r-- | lib/api/entities/appearance.rb | 6 | ||||
-rw-r--r-- | lib/api/entities/application_setting.rb | 5 | ||||
-rw-r--r-- | lib/api/entities/basic_project_details.rb | 10 | ||||
-rw-r--r-- | lib/api/entities/bulk_imports/entity.rb | 5 | ||||
-rw-r--r-- | lib/api/entities/ml/mlflow/run_info.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/project_integration_basic.rb | 1 | ||||
-rw-r--r-- | lib/api/entities/remote_mirror.rb | 2 |
7 files changed, 27 insertions, 3 deletions
diff --git a/lib/api/entities/appearance.rb b/lib/api/entities/appearance.rb index 94a39568393..cabdf68c23a 100644 --- a/lib/api/entities/appearance.rb +++ b/lib/api/entities/appearance.rb @@ -4,13 +4,17 @@ module API module Entities class Appearance < Grape::Entity expose :title - expose :short_title + expose :pwa_short_name expose :description expose :logo do |appearance, options| appearance.logo.url end + expose :pwa_icon do |appearance, options| + appearance.pwa_icon.url + end + expose :header_logo do |appearance, options| appearance.header_logo.url end diff --git a/lib/api/entities/application_setting.rb b/lib/api/entities/application_setting.rb index db51d4380d0..8aace9126d6 100644 --- a/lib/api/entities/application_setting.rb +++ b/lib/api/entities/application_setting.rb @@ -43,6 +43,11 @@ module API # This field is deprecated and always returns true expose(:housekeeping_bitmaps_enabled) { |_settings, _options| true } + + # These fields are deprecated and always returns housekeeping_optimize_repository_period value + expose(:housekeeping_full_repack_period) { |settings, _options| settings.housekeeping_optimize_repository_period } + expose(:housekeeping_gc_period) { |settings, _options| settings.housekeeping_optimize_repository_period } + expose(:housekeeping_incremental_repack_period) { |settings, _options| settings.housekeeping_optimize_repository_period } end end end diff --git a/lib/api/entities/basic_project_details.rb b/lib/api/entities/basic_project_details.rb index 2585b2d0b6d..f89e5adca6d 100644 --- a/lib/api/entities/basic_project_details.rb +++ b/lib/api/entities/basic_project_details.rb @@ -15,7 +15,10 @@ module API expose :ssh_url_to_repo, documentation: { type: 'string', example: 'git@gitlab.example.com:gitlab/gitlab.git' } expose :http_url_to_repo, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab.git' } expose :web_url, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab' } - expose :readme_url, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab/blob/master/README.md' } + with_options if: ->(_, _) { user_has_access_to_project_repository? } do + expose :readme_url, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab/blob/master/README.md' } + expose :forks_count, documentation: { type: 'integer', example: 1 } + end expose :license_url, if: :license, documentation: { type: 'string', example: 'https://gitlab.example.com/gitlab/gitlab/blob/master/LICENCE' } do |project| license = project.repository.license_blob @@ -33,7 +36,6 @@ module API project.avatar_url(only_path: false) end - expose :forks_count, documentation: { type: 'integer', example: 1 } expose :star_count, documentation: { type: 'integer', example: 1 } expose :last_activity_at, documentation: { type: 'dateTime', example: '2013-09-30T13:46:02Z' } expose :namespace, using: 'API::Entities::NamespaceBasic' @@ -74,6 +76,10 @@ module API project.topics.pluck(:name).sort # rubocop:disable CodeReuse/ActiveRecord end end + + def user_has_access_to_project_repository? + Ability.allowed?(options[:current_user], :read_code, project) + end end end end diff --git a/lib/api/entities/bulk_imports/entity.rb b/lib/api/entities/bulk_imports/entity.rb index 8f9fbe57935..176d10b2580 100644 --- a/lib/api/entities/bulk_imports/entity.rb +++ b/lib/api/entities/bulk_imports/entity.rb @@ -9,7 +9,11 @@ module API expose :status_name, as: :status, documentation: { type: 'string', example: 'created', values: %w[created started finished timeout failed] } + expose :entity_type, documentation: { type: 'string', values: %w[group project] } expose :source_full_path, documentation: { type: 'string', example: 'source_group' } + expose :full_path, as: :destination_full_path, documentation: { + type: 'string', example: 'some_group/source_project' + } expose :destination_name, documentation: { type: 'string', example: 'destination_slug' } # deprecated expose :destination_slug, documentation: { type: 'string', example: 'destination_slug' } expose :destination_namespace, documentation: { type: 'string', example: 'destination_path' } @@ -19,6 +23,7 @@ module API expose :created_at, documentation: { type: 'dateTime', example: '2012-05-28T04:42:42-07:00' } expose :updated_at, documentation: { type: 'dateTime', example: '2012-05-28T04:42:42-07:00' } expose :failures, using: EntityFailure, documentation: { is_array: true } + expose :migrate_projects, documentation: { type: 'boolean', example: true } end end end diff --git a/lib/api/entities/ml/mlflow/run_info.rb b/lib/api/entities/ml/mlflow/run_info.rb index d3934545ba4..60e4416e011 100644 --- a/lib/api/entities/ml/mlflow/run_info.rb +++ b/lib/api/entities/ml/mlflow/run_info.rb @@ -10,6 +10,7 @@ module API expose(:experiment_id) { |candidate| candidate.experiment.iid.to_s } expose(:start_time) { |candidate| candidate.start_time || 0 } expose :end_time, expose_nil: false + expose :name, as: :run_name, expose_nil: false expose(:status) { |candidate| candidate.status.to_s.upcase } expose(:artifact_uri) { |candidate, options| "#{options[:packages_url]}#{candidate.artifact_root}" } expose(:lifecycle_stage) { |candidate| 'active' } diff --git a/lib/api/entities/project_integration_basic.rb b/lib/api/entities/project_integration_basic.rb index aa0ad158b83..b7c56d7cca1 100644 --- a/lib/api/entities/project_integration_basic.rb +++ b/lib/api/entities/project_integration_basic.rb @@ -14,6 +14,7 @@ module API expose :commit_events, documentation: { type: 'boolean' } expose :push_events, documentation: { type: 'boolean' } expose :issues_events, documentation: { type: 'boolean' } + expose :incident_events, documentation: { type: 'boolean' } expose :confidential_issues_events, documentation: { type: 'boolean' } expose :merge_requests_events, documentation: { type: 'boolean' } expose :tag_push_events, documentation: { type: 'boolean' } diff --git a/lib/api/entities/remote_mirror.rb b/lib/api/entities/remote_mirror.rb index 9fb5b2697bc..f64ec71bffb 100644 --- a/lib/api/entities/remote_mirror.rb +++ b/lib/api/entities/remote_mirror.rb @@ -16,3 +16,5 @@ module API end end end + +API::Entities::RemoteMirror.prepend_mod |