Class: Gitlab::BitbucketServerImport::Importers::PullRequestNotesImporter
- Inherits:
-
Object
- Object
- Gitlab::BitbucketServerImport::Importers::PullRequestNotesImporter
- Includes:
- Loggable
- Defined in:
- lib/gitlab/bitbucket_server_import/importers/pull_request_notes_importer.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, hash) ⇒ PullRequestNotesImporter
constructor
A new instance of PullRequestNotesImporter.
Methods included from Loggable
#log_debug, #log_error, #log_info, #log_warn
Constructor Details
#initialize(project, hash) ⇒ PullRequestNotesImporter
Returns a new instance of PullRequestNotesImporter.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/gitlab/bitbucket_server_import/importers/pull_request_notes_importer.rb', line 9 def initialize(project, hash) @project = project @formatter = Gitlab::ImportFormatter.new @client = BitbucketServer::Client.new(project.import_data.credentials) @project_key = project.import_data.data['project_key'] @repository_slug = project.import_data.data['repo_slug'] @user_finder = UserFinder.new(project) # TODO: Convert object into a object instead of using it as a hash @object = hash.with_indifferent_access end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/gitlab/bitbucket_server_import/importers/pull_request_notes_importer.rb', line 21 def execute log_info(import_stage: 'import_pull_request_notes', message: 'starting', iid: object[:iid]) merge_request = project.merge_requests.find_by(iid: object[:iid]) # rubocop: disable CodeReuse/ActiveRecord if merge_request activities = client.activities(project_key, repository_slug, merge_request.iid) comments, other_activities = activities.partition(&:comment?) merge_event = other_activities.find(&:merge_event?) import_merge_event(merge_request, merge_event) if merge_event inline_comments, pr_comments = comments.partition(&:inline_comment?) import_inline_comments(inline_comments.map(&:comment), merge_request) import_standalone_pr_comments(pr_comments.map(&:comment), merge_request) end log_info(import_stage: 'import_pull_request_notes', message: 'finished', iid: object[:iid]) end |