DEV: Add plugin api to permit bulk_action parameters (#10638)

DEV: Add plugin api to permit bulk_action parameters (#10638)

diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb
index 3db2290..d6fadb3 100644
--- a/app/controllers/topics_controller.rb
+++ b/app/controllers/topics_controller.rb
@@ -868,7 +868,7 @@ class TopicsController < ApplicationController
 
     operation = params
       .require(:operation)
-      .permit(:type, :group, :category_id, :notification_level_id, tags: [])
+      .permit(:type, :group, :category_id, :notification_level_id, *DiscoursePluginRegistry.permitted_bulk_action_parameters, tags: [])
       .to_h.symbolize_keys
 
     raise ActionController::ParameterMissing.new(:operation_type) if operation[:type].blank?
diff --git a/lib/discourse_plugin_registry.rb b/lib/discourse_plugin_registry.rb
index 93e2c11..9e87e13 100644
--- a/lib/discourse_plugin_registry.rb
+++ b/lib/discourse_plugin_registry.rb
@@ -82,6 +82,8 @@ class DiscoursePluginRegistry
   define_filtered_register :api_parameter_routes
   define_filtered_register :api_key_scope_mappings
 
+  define_filtered_register :permitted_bulk_action_parameters
+
   def self.register_auth_provider(auth_provider)
     self.auth_providers << auth_provider
   end
diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb
index e0dec5f..4729223 100644
--- a/lib/plugin/instance.rb
+++ b/lib/plugin/instance.rb
@@ -899,4 +899,8 @@ class Plugin::Instance
     end
     nil
   end
+
+  def register_permitted_bulk_action_parameter(name)
+    DiscoursePluginRegistry.register_permitted_bulk_action_parameter(name, self)
+  end
 end

GitHub sha: ddab7cc2

This commit appears in #10638 which was merged by davidtaylorhq.