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

This commit is contained in:
Ahmed Gagan 2020-09-10 21:48:45 +05:30 committed by GitHub
parent 296c707f55
commit ddab7cc239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -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?

View File

@ -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

View File

@ -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