FEATURE: Support append when bulk tagging via rake (#9978)

FEATURE: Support append when bulk tagging via rake (#9978)

New argument option for the tags:bulk_tag_category rake task. Backwards compatible - defaults to false (no append) if no argument given.

diff --git a/lib/tasks/tags.rake b/lib/tasks/tags.rake
index 192d086..6767b29 100644
--- a/lib/tasks/tags.rake
+++ b/lib/tasks/tags.rake
@@ -1,8 +1,10 @@
 # frozen_string_literal: true
 
-task "tags:bulk_tag_category", [:tags, :category] => [:environment] do |_, args|
+task "tags:bulk_tag_category", [:tags, :category, :append] => [:environment] do |_, args|
+  args.with_defaults(append: false)
   tags = args[:tags].split("|")
   category_id = args[:category]
+  append = args[:append]
 
   if !tags || !category_id
     puts 'ERROR: Expecting tags:bulk_tag_category["tag",category_id]'
@@ -16,7 +18,7 @@ task "tags:bulk_tag_category", [:tags, :category] => [:environment] do |_, args|
   total = category.topics.count
 
   category.topics.find_each do |topic|
-    DiscourseTagging.tag_topic_by_names(topic, guardian, tags)
+    DiscourseTagging.tag_topic_by_names(topic, guardian, tags, append: append)
     print_status(tagged += 1, total)
   end
 

GitHub sha: 76af25f7

This commit appears in #9978 which was approved by techAPJ. It was merged by jomaxro.