Commit 73e5db1b authored by Kassio Borges's avatar Kassio Borges

Github importer Avoid touching MR when importing merged by

When importing a Pull Request `merged by` field, if the user cannot be
mapped to a Gitlab user, a note is created, which `touch` the
MergeRequest (callback). This callback can be skipped by setting the
`importing` attribute of the note to `true`.

Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/289671
parent 7090019c
---
title: Github importer - Avoid touching MR when importing pull request `merged by` field
merge_request: 48729
author:
type: fixed
......@@ -26,6 +26,7 @@ module Gitlab
}, unique_by: :merge_request_id)
else
merge_request.notes.create!(
importing: true,
note: "*Merged by: #{pull_request.merged_by.login}*",
author_id: project.creator_id,
project: project,
......
......@@ -28,7 +28,9 @@ RSpec.describe Gitlab::GithubImport::Importer::PullRequestMergedByImporter, :cle
end
it 'adds a note referencing the merger user when the user cannot be mapped' do
expect { subject.execute }.to change(Note, :count).by(1)
expect { subject.execute }
.to change(Note, :count).by(1)
.and not_change(merge_request, :updated_at)
last_note = merge_request.notes.last
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment