Merge pull request #6380 from discourse/rake-destroy-sub-category

FIX: Allow `rake destroy:topics` to delete topics in sub-categories
This commit is contained in:
Blake Erickson
2018-09-10 10:26:04 -06:00
committed by GitHub
3 changed files with 22 additions and 12 deletions

View File

@ -2,10 +2,12 @@
# content and users from your site, but keeping your site settings,
# theme, and category structure.
desc "Remove all topics in a category"
task "destroy:topics", [:category] => :environment do |t, args|
task "destroy:topics", [:category, :parent_category] => :environment do |t, args|
category = args[:category]
puts "Going to delete all topics in the #{category} category"
puts log = DestroyTask.destroy_topics(category)
parent_category = args[:parent_category]
descriptive_slug = parent_category ? "#{parent_category}/#{category}" : category
puts "Going to delete all topics in the #{descriptive_slug} category"
puts log = DestroyTask.destroy_topics(category, parent_category)
end
desc "Remove all topics in all categories"