mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 22:35:03 +08:00
improve logic and performance on front page to avoid massive query
This commit is contained in:
@ -404,6 +404,12 @@ class Guardian
|
||||
@secure_category_ids ||= @user.secure_category_ids
|
||||
end
|
||||
|
||||
# all allowed category ids
|
||||
def allowed_category_ids
|
||||
unrestricted = Category.where(read_restricted: false).pluck(:id)
|
||||
unrestricted.concat(secure_category_ids)
|
||||
end
|
||||
|
||||
def topic_create_allowed_category_ids
|
||||
@topic_create_allowed_category_ids ||= @user.topic_create_allowed_category_ids
|
||||
end
|
||||
|
Reference in New Issue
Block a user