FIX: Avoid lograge error when controller doesn't respond to `current_user`.
https://meta.discourse.org/t/broken-third-party-plugins-can-break-logging/94256
This commit is contained in:
parent
d7b1919ead
commit
6d588e43cc
|
@ -19,7 +19,9 @@ if (Rails.env.production? && SiteSetting.logging_provider == 'lograge') || ENV["
|
|||
begin
|
||||
username =
|
||||
begin
|
||||
controller.current_user&.username
|
||||
if controller.respond_to?(:current_user)
|
||||
controller.current_user&.username
|
||||
end
|
||||
rescue Discourse::InvalidAccess
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue