summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-06-09 22:35:06 -0700
committerStan Hu <stanhu@gmail.com>2018-06-11 08:33:06 -0700
commit6defeb0a7d6928ad32d4d7a2fa35d0d71dbb9dea (patch)
tree1fb22e52bca3a7040df45415db2b8fd5cfb9a3ab
parentf646a8b9bc95fd6cecaa754f7dd0e8370c201502 (diff)
downloadgitlab-ce-6defeb0a7d6928ad32d4d7a2fa35d0d71dbb9dea.tar.gz
Expire Wiki content cache after importing a repository
The cache state for Wikis that were imported via GitHub or Bitbucket does not appear to have been flushed after a successful import. Closes #47546
-rw-r--r--app/models/project.rb1
-rw-r--r--changelogs/unreleased/sh-expire-content-cache-after-import.yml5
-rw-r--r--lib/gitlab/github_import/sequential_importer.rb2
-rw-r--r--lib/tasks/import.rake2
-rw-r--r--spec/lib/gitlab/github_import/sequential_importer_spec.rb1
-rw-r--r--spec/models/project_spec.rb3
6 files changed, 9 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 60cd13b371f..bc91b0aa1b0 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1615,6 +1615,7 @@ class Project < ActiveRecord::Base
def after_import
repository.after_import
+ wiki.repository.after_import
import_finish
remove_import_jid
update_project_counter_caches
diff --git a/changelogs/unreleased/sh-expire-content-cache-after-import.yml b/changelogs/unreleased/sh-expire-content-cache-after-import.yml
new file mode 100644
index 00000000000..8876a487b86
--- /dev/null
+++ b/changelogs/unreleased/sh-expire-content-cache-after-import.yml
@@ -0,0 +1,5 @@
+---
+title: Expire Wiki content cache after importing a repository
+merge_request:
+author:
+type: fixed
diff --git a/lib/gitlab/github_import/sequential_importer.rb b/lib/gitlab/github_import/sequential_importer.rb
index 3cad919b4eb..6a181caf65d 100644
--- a/lib/gitlab/github_import/sequential_importer.rb
+++ b/lib/gitlab/github_import/sequential_importer.rb
@@ -42,8 +42,6 @@ module Gitlab
klass.new(project, client, parallel: false).execute
end
- project.repository.after_import
-
true
end
end
diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake
index aafbe52e5f8..0fd184d243f 100644
--- a/lib/tasks/import.rake
+++ b/lib/tasks/import.rake
@@ -50,7 +50,7 @@ class GithubImport
end
if import_success
- @project.import_finish
+ @project.after_import
puts "Import finished. Timings: #{timings}".color(:green)
else
puts "Import was not successful. Errors were as follows:"
diff --git a/spec/lib/gitlab/github_import/sequential_importer_spec.rb b/spec/lib/gitlab/github_import/sequential_importer_spec.rb
index 6089b0b751f..05d3243f806 100644
--- a/spec/lib/gitlab/github_import/sequential_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/sequential_importer_spec.rb
@@ -30,7 +30,6 @@ describe Gitlab::GithubImport::SequentialImporter do
expect(instance).to receive(:execute)
end
- expect(repository).to receive(:after_import)
expect(importer.execute).to eq(true)
end
end
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 1a6ad3edd78..d385d617731 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -3391,10 +3391,11 @@ describe Project do
end
describe '#after_import' do
- let(:project) { build(:project) }
+ let(:project) { create(:project) }
it 'runs the correct hooks' do
expect(project.repository).to receive(:after_import)
+ expect(project.wiki.repository).to receive(:after_import)
expect(project).to receive(:import_finish)
expect(project).to receive(:update_project_counter_caches)
expect(project).to receive(:remove_import_jid)