mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Ensure UserField changes are reflected instantly in webhooks (#12291)
The Guardian object memoizes a list of allowed user fields. Normally this is fine because Guardian objects only persist for a single request. However, the WebHook class was memoizing a guardian at the class level. This meant that an app restart was required for changes to be reflected. Plus, the Guardian was being shared across all sites in a multisite instance. Initializing a guardian is cheap, so we can manage without memoization here.
This commit is contained in:
@@ -110,7 +110,7 @@ class WebHook < ActiveRecord::Base
|
||||
private
|
||||
|
||||
def self.guardian
|
||||
@guardian ||= Guardian.new(Discourse.system_user)
|
||||
Guardian.new(Discourse.system_user)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user