Commit 286a5938 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'gitea_import_ignore_pull_request_comments' into 'master'

Don't import pull request comments from Gitea repos

Closes #63071

See merge request gitlab-org/gitlab-ce!29521
parents 56c365bd 265e52bb
...@@ -55,7 +55,12 @@ module Gitlab ...@@ -55,7 +55,12 @@ module Gitlab
import_pull_requests import_pull_requests
import_issues import_issues
import_comments(:issues) import_comments(:issues)
# Gitea doesn't have an API endpoint for pull requests comments
unless project.gitea_import?
import_comments(:pull_requests) import_comments(:pull_requests)
end
import_wiki import_wiki
# Gitea doesn't have a Release API yet # Gitea doesn't have a Release API yet
......
...@@ -13,21 +13,22 @@ describe Gitlab::LegacyGithubImport::Importer do ...@@ -13,21 +13,22 @@ describe Gitlab::LegacyGithubImport::Importer do
expected_called = [ expected_called = [
:import_labels, :import_milestones, :import_pull_requests, :import_issues, :import_labels, :import_milestones, :import_pull_requests, :import_issues,
:import_wiki, :import_releases, :handle_errors :import_wiki, :import_releases, :handle_errors,
[:import_comments, :issues],
[:import_comments, :pull_requests]
] ]
expected_called -= expected_not_called expected_called -= expected_not_called
aggregate_failures do aggregate_failures do
expected_called.each do |method_name| expected_called.each do |method_name, arg|
expect(importer).to receive(method_name) base_expectation = proc { expect(importer).to receive(method_name) }
arg ? base_expectation.call.with(arg) : base_expectation.call
end end
expect(importer).to receive(:import_comments).with(:issues) expected_not_called.each do |method_name, arg|
expect(importer).to receive(:import_comments).with(:pull_requests) base_expectation = proc { expect(importer).not_to receive(method_name) }
arg ? base_expectation.call.with(arg) : base_expectation.call
expected_not_called.each do |method_name|
expect(importer).not_to receive(method_name)
end end
end end
...@@ -289,7 +290,7 @@ describe Gitlab::LegacyGithubImport::Importer do ...@@ -289,7 +290,7 @@ describe Gitlab::LegacyGithubImport::Importer do
end end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute' do it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute' do
let(:expected_not_called) { [:import_releases] } let(:expected_not_called) { [:import_releases, [:import_comments, :pull_requests]] }
end end
it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute an error occurs' it_behaves_like 'Gitlab::LegacyGithubImport::Importer#execute an error occurs'
it_behaves_like 'Gitlab::LegacyGithubImport unit-testing' it_behaves_like 'Gitlab::LegacyGithubImport unit-testing'
......
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