Class: Types::ProjectType

Inherits:
BaseObject
  • Object
show all
Defined in:
app/graphql/types/project_type.rb

Instance Method Summary collapse

Methods inherited from BaseObject

accepts, assignable?, authorization, authorize, authorized?, #current_user, #id

Methods included from Gitlab::Graphql::Present

#present, #unpresented

Instance Method Details

#avatar_urlObject


467
468
469
# File 'app/graphql/types/project_type.rb', line 467

def avatar_url
  object.avatar_url(only_path: false)
end

#container_repositories_countObject


483
484
485
# File 'app/graphql/types/project_type.rb', line 483

def container_repositories_count
  project.container_repositories.size
end

#jobs_enabledObject


471
472
473
# File 'app/graphql/types/project_type.rb', line 471

def jobs_enabled
  object.feature_available?(:builds, context[:current_user])
end

#label(title:) ⇒ Object


441
442
443
444
445
446
447
448
# File 'app/graphql/types/project_type.rb', line 441

def label(title:)
  BatchLoader::GraphQL.for(title).batch(key: project) do |titles, loader, args|
    LabelsFinder
      .new(current_user, project: args[:key], title: titles)
      .execute
      .each { |label| loader.call(label.title, label) }
  end
end

#open_issues_countObject


475
476
477
# File 'app/graphql/types/project_type.rb', line 475

def open_issues_count
  object.open_issues_count if object.feature_available?(:issues, context[:current_user])
end

#sast_ci_configurationObject


487
488
489
490
491
# File 'app/graphql/types/project_type.rb', line 487

def sast_ci_configuration
  return unless Ability.allowed?(current_user, :download_code, object)

  ::Security::CiConfiguration::SastParserService.new(object).configuration
end

#service_desk_addressObject


493
494
495
496
497
# File 'app/graphql/types/project_type.rb', line 493

def service_desk_address
  return unless Ability.allowed?(current_user, :admin_issue, project)

  object.service_desk_address
end

#statisticsObject


479
480
481
# File 'app/graphql/types/project_type.rb', line 479

def statistics
  Gitlab::Graphql::Loaders::BatchProjectStatisticsLoader.new(object.id).find
end