mirror of
https://github.com/discourse/discourse.git
synced 2025-04-25 07:34:28 +08:00
PERF: properly preload all category notification levels
This commit is contained in:
parent
d20f6e0cb0
commit
f9e6e5a66a
@ -53,8 +53,10 @@ class Site
|
||||
category_user = Hash[*CategoryUser.where(user: @guardian.user).pluck(:category_id, :notification_level).flatten]
|
||||
end
|
||||
|
||||
regular = CategoryUser.notification_levels[:regular]
|
||||
|
||||
categories.each do |category|
|
||||
category.notification_level = category_user[category.id]
|
||||
category.notification_level = category_user[category.id] || regular
|
||||
category.permission = CategoryGroup.permission_types[:full] if allowed_topic_create.include?(category.id)
|
||||
category.has_children = with_children.include?(category.id)
|
||||
by_id[category.id] = category
|
||||
|
Loading…
x
Reference in New Issue
Block a user