mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 20:20:43 +08:00
FIX: Avoid N+1 query in Site.json_for
(#14729)
This commit is contained in:
parent
31aa071e54
commit
c7768b6d16
|
@ -138,12 +138,11 @@ class Site
|
|||
end
|
||||
|
||||
def self.json_for(guardian)
|
||||
|
||||
if guardian.anonymous? && SiteSetting.login_required
|
||||
return {
|
||||
periods: TopTopic.periods.map(&:to_s),
|
||||
filters: Discourse.filters.map(&:to_s),
|
||||
user_fields: UserField.all.map do |userfield|
|
||||
user_fields: UserField.includes(:user_field_options).all.map do |userfield|
|
||||
UserFieldSerializer.new(userfield, root: false, scope: guardian)
|
||||
end,
|
||||
auth_providers: Discourse.enabled_auth_providers.map do |provider|
|
||||
|
|
Loading…
Reference in New Issue
Block a user