diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index aaef4efca4f..7bb49bcde9d 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -104,7 +104,9 @@ class ImportScripts::Base end # Some changes that should not be rolled back after the script is done - SiteSetting.purge_unactivated_users_grace_period_days = 60 + if SiteSetting.purge_unactivated_users_grace_period_days > 0 + SiteSetting.purge_unactivated_users_grace_period_days = 60 + end SiteSetting.purge_deleted_uploads_grace_period_days = 90 RateLimiter.disable diff --git a/spec/script/import_scripts/base_spec.rb b/spec/script/import_scripts/base_spec.rb index e7594d2fa56..a3b1199bb48 100644 --- a/spec/script/import_scripts/base_spec.rb +++ b/spec/script/import_scripts/base_spec.rb @@ -53,5 +53,12 @@ describe ImportScripts::Base do expect(Bookmark.count).to eq(5) expect(Post.count).to eq(5) expect(User.where('id > 0').count).to eq(1) + expect(SiteSetting.purge_unactivated_users_grace_period_days).to eq(60) + end + + it "does not change purge unactivated users setting if disabled" do + SiteSetting.purge_unactivated_users_grace_period_days = 0 + MockSpecImporter.new(import_data).perform + expect(SiteSetting.purge_unactivated_users_grace_period_days).to eq(0) end end