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

reopened.rb « events « importer « github_import « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8abeba0777d5c8aa5809c7508c305a656f25a260 (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
36
37
38
39
40
# frozen_string_literal: true

module Gitlab
  module GithubImport
    module Importer
      module Events
        class Reopened < BaseImporter
          def execute(issue_event)
            create_event(issue_event)
            create_state_event(issue_event)
          end

          private

          def create_event(issue_event)
            Event.create!(
              project_id: project.id,
              author_id: author_id(issue_event),
              action: 'reopened',
              target_type: issuable_type(issue_event),
              target_id: issuable_db_id(issue_event),
              created_at: issue_event.created_at,
              updated_at: issue_event.created_at
            )
          end

          def create_state_event(issue_event)
            attrs = {
              user_id: author_id(issue_event),
              state: 'reopened',
              created_at: issue_event.created_at
            }.merge(resource_event_belongs_to(issue_event))

            ResourceStateEvent.create!(attrs)
          end
        end
      end
    end
  end
end