mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: API for plugins to add post update params and handlers (#12505)
This commit is contained in:
committed by
GitHub
parent
e7fb45cc29
commit
371afc45e0
@@ -337,6 +337,13 @@ class Plugin::Instance
|
||||
end
|
||||
end
|
||||
|
||||
# Add a permitted_update_param to Post, respecting if the plugin is enabled
|
||||
def add_permitted_post_update_param(attribute, &block)
|
||||
reloadable_patch do |plugin|
|
||||
::Post.plugin_permitted_update_params[attribute] = { plugin: plugin, handler: block }
|
||||
end
|
||||
end
|
||||
|
||||
# Add validation method but check that the plugin is enabled
|
||||
def validate(klass, name, &block)
|
||||
klass = klass.to_s.classify.constantize
|
||||
|
||||
Reference in New Issue
Block a user