mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
PERF: properly preload all category notification levels
This commit is contained in:
parent
d20f6e0cb0
commit
f9e6e5a66a
1 changed files with 3 additions and 1 deletions
|
@ -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…
Reference in a new issue