Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/graphql/types/ci/stage_type.rb')
-rw-r--r--app/graphql/types/ci/stage_type.rb55
1 files changed, 17 insertions, 38 deletions
diff --git a/app/graphql/types/ci/stage_type.rb b/app/graphql/types/ci/stage_type.rb
index 56b4f248697..1be9e3192a9 100644
--- a/app/graphql/types/ci/stage_type.rb
+++ b/app/graphql/types/ci/stage_type.rb
@@ -2,20 +2,26 @@
module Types
module Ci
- # rubocop: disable Graphql/AuthorizeTypes
class StageType < BaseObject
graphql_name 'CiStage'
+ authorize :read_commit_status
- field :name, GraphQL::STRING_TYPE, null: true,
- description: 'Name of the stage.'
- field :groups, Ci::GroupType.connection_type, null: true,
- extras: [:lookahead],
- description: 'Group of jobs for the stage.'
- field :detailed_status, Types::Ci::DetailedStatusType, null: true,
- description: 'Detailed status of the stage.'
- field :jobs, Ci::JobType.connection_type, null: true,
- description: 'Jobs for the stage.',
- method: 'latest_statuses'
+ field :name,
+ type: GraphQL::STRING_TYPE,
+ null: true,
+ description: 'Name of the stage.'
+ field :groups,
+ type: Ci::GroupType.connection_type,
+ null: true,
+ extras: [:lookahead],
+ description: 'Group of jobs for the stage.'
+ field :detailed_status, Types::Ci::DetailedStatusType,
+ null: true,
+ description: 'Detailed status of the stage.'
+ field :jobs, Ci::JobType.connection_type,
+ null: true,
+ description: 'Jobs for the stage.',
+ method: 'latest_statuses'
def detailed_status
object.detailed_status(current_user)
@@ -37,33 +43,6 @@ module Types
key = indexed[stage_id]
groups = ::Ci::Group.fabricate(project, key.stage, statuses)
- if Feature.enabled?(:ci_no_empty_groups, project)
- groups.each do |group|
- rejected = group.jobs.reject { |job| Ability.allowed?(current_user, :read_commit_status, job) }
- group.jobs.select! { |job| Ability.allowed?(current_user, :read_commit_status, job) }
- next unless group.jobs.empty?
-
- exc = StandardError.new('Empty Ci::Group')
- traces = rejected.map do |job|
- trace = []
- policy = Ability.policy_for(current_user, job)
- policy.debug(:read_commit_status, trace)
- trace
- end
- extra = {
- current_user_id: current_user&.id,
- project_id: project.id,
- pipeline_id: pl.id,
- stage_id: stage_id,
- group_name: group.name,
- rejected_job_ids: rejected.map(&:id),
- rejected_traces: traces
- }
- Gitlab::ErrorTracking.track_exception(exc, extra)
- end
- groups.reject! { |group| group.jobs.empty? }
- end
-
loader.call(key, groups)
end
end