summaryrefslogtreecommitdiff
path: root/lib/api/entities/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/entities/project.rb')
-rw-r--r--lib/api/entities/project.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb
index 442013c07dd..68d91fc6970 100644
--- a/lib/api/entities/project.rb
+++ b/lib/api/entities/project.rb
@@ -43,7 +43,6 @@ module API
expose :visibility
expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group }
expose :resolve_outdated_diff_discussions
- expose :container_registry_enabled
expose :container_expiration_policy, using: Entities::ContainerExpirationPolicy,
if: -> (project, _) { project.container_expiration_policy }
@@ -54,6 +53,13 @@ module API
expose(:wiki_enabled) { |project, options| project.feature_available?(:wiki, options[:current_user]) }
expose(:jobs_enabled) { |project, options| project.feature_available?(:builds, options[:current_user]) }
expose(:snippets_enabled) { |project, options| project.feature_available?(:snippets, options[:current_user]) }
+ expose(:container_registry_enabled) do |project, options|
+ if ::Feature.enabled?(:read_container_registry_access_level, project.namespace, default_enabled: :yaml)
+ project.feature_available?(:container_registry, options[:current_user])
+ else
+ project.read_attribute(:container_registry_enabled)
+ end
+ end
expose :service_desk_enabled
expose :service_desk_address
@@ -89,6 +95,7 @@ module API
expose :runners_token, if: lambda { |_project, options| options[:user_can_admin_project] }
expose :ci_default_git_depth
expose :ci_forward_deployment_enabled
+ expose :ci_job_token_scope_enabled
expose :public_builds, as: :public_jobs
expose :build_git_strategy, if: lambda { |project, options| options[:user_can_admin_project] } do |project, options|
project.build_allow_git_fetch ? 'fetch' : 'clone'
@@ -108,6 +115,7 @@ module API
expose :remove_source_branch_after_merge
expose :printing_merge_request_link_enabled
expose :merge_method
+ expose :squash_option
expose :suggestion_commit_message
expose :statistics, using: 'API::Entities::ProjectStatistics', if: -> (project, options) {
options[:statistics] && Ability.allowed?(options[:current_user], :read_statistics, project)
@@ -120,12 +128,13 @@ module API
expose :repository_storage, if: ->(project, options) {
Ability.allowed?(options[:current_user], :change_repository_storage, project)
}
+ expose :keep_latest_artifacts_available?, as: :keep_latest_artifact
# rubocop: disable CodeReuse/ActiveRecord
def self.preload_relation(projects_relation, options = {})
- # Preloading tags, should be done with using only `:tags`,
- # as `:tags` are defined as: `has_many :tags, through: :taggings`
- # N+1 is solved then by using `subject.tags.map(&:name)`
+ # Preloading topics, should be done with using only `:topics`,
+ # as `:topics` are defined as: `has_many :topics, through: :taggings`
+ # N+1 is solved then by using `subject.topics.map(&:name)`
# MR describing the solution: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/20555
super(projects_relation).preload(group: :namespace_settings)
.preload(:ci_cd_settings)
@@ -136,7 +145,7 @@ module API
.preload(project_group_links: { group: :route },
fork_network: :root_project,
fork_network_member: :forked_from_project,
- forked_from_project: [:route, :forks, :tags, :group, :project_feature, namespace: [:route, :owner]])
+ forked_from_project: [:route, :topics, :group, :project_feature, namespace: [:route, :owner]])
end
# rubocop: enable CodeReuse/ActiveRecord