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

interacts_with_merge_request.rb « merge_requests « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bef2d39dc5c71af90015c4ded3d5047de2731ff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module Types
  module MergeRequests
    module InteractsWithMergeRequest
      extend ActiveSupport::Concern

      included do
        field :merge_request_interaction,
              type: ::Types::UserMergeRequestInteractionType,
              null: true,
              extras: [:parent],
              description: "Details of this user's interactions with the merge request."
      end

      def merge_request_interaction(parent:, id: nil)
        # need the connection parent if called from a connection node:
        parent = parent.parent if parent.try(:field)&.connection?
        Users::MergeRequestInteraction.new(user: object, merge_request: parent)
      end
    end
  end
end