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

sentry_detailed_error_resolver.rb « error_tracking « resolvers « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5027403e95c030a16d850e01f35ce72b1325d0ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

module Resolvers
  module ErrorTracking
    class SentryDetailedErrorResolver < BaseResolver
      argument :id, GraphQL::ID_TYPE,
                required: true,
                description: 'ID of the Sentry issue'

      def resolve(**args)
        current_user = context[:current_user]
        issue_id = GlobalID.parse(args[:id])&.model_id

        # Get data from Sentry
        response = ::ErrorTracking::IssueDetailsService.new(
          project,
          current_user,
          { issue_id: issue_id }
        ).execute
        issue = response[:issue]
        issue.gitlab_project = project if issue

        issue
      end

      private

      def project
        return object.gitlab_project if object.respond_to?(:gitlab_project)

        object
      end
    end
  end
end