FIX: lounge category security settings won't be reset after an upgrade

This commit is contained in:
Neil Lalonde 2017-06-06 16:55:20 -04:00
parent 0de5d01d79
commit 6aa0823bf4
2 changed files with 4 additions and 3 deletions

View File

@ -43,7 +43,7 @@ class CategorySerializer < BasicCategorySerializer
end
def include_is_special?
[SiteSetting.lounge_category_id, SiteSetting.meta_category_id, SiteSetting.staff_category_id, SiteSetting.uncategorized_category_id]
[SiteSetting.meta_category_id, SiteSetting.staff_category_id, SiteSetting.uncategorized_category_id]
.include? object.id
end

View File

@ -1,9 +1,10 @@
unless Rails.env.test?
lounge = Category.find_by(id: SiteSetting.lounge_category_id)
if lounge and !lounge.group_ids.include?(Group[:trust_level_3].id)
if lounge && lounge.created_at == lounge.updated_at &&
!lounge.group_ids.include?(Group[:trust_level_3].id)
# The category for users with trust level 3 has been created.
# Add permissions and a description to it.
# Add initial permissions and description. They can be changed later.
Category.transaction do
lounge.group_names = ['trust_level_3']