mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 04:41:25 +08:00
FIX: Remove plugin.enabled?
checks at initialization time (#6166)
Checking `plugin.enabled?` while initializing plugins causes issues in two ways: - An application restart is required for changes to take effect. A load-balanced multi-server environment could behave very weirdly if containers restart at different times. - In a multisite environment, it takes the `enabled?` setting from the default site. Changes on that site affect all other sites in the cluster. Instead, `plugin.enabled?` should be checked at runtime, in the context of a request. This commit removes `plugin.enabled?` from many `instance.rb` methods. I have added a working `plugin.enabled?` implementation for methods that actually affect security/functionality: - `post_custom_fields_whitelist` - `whitelist_staff_user_custom_field` - `add_permitted_post_create_param`
This commit is contained in:
@ -615,8 +615,8 @@ class PostsController < ApplicationController
|
||||
:visible
|
||||
]
|
||||
|
||||
if Post.permitted_create_params.present?
|
||||
permitted.concat(Post.permitted_create_params.to_a)
|
||||
Post.plugin_permitted_create_params.each do |key, plugin|
|
||||
permitted << key if plugin.enabled?
|
||||
end
|
||||
|
||||
# param munging for WordPress
|
||||
|
Reference in New Issue
Block a user