From 6aa0823bf4975efe3b4354070a58c23f90d686f9 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Tue, 6 Jun 2017 16:55:20 -0400 Subject: [PATCH] FIX: lounge category security settings won't be reset after an upgrade --- app/serializers/category_serializer.rb | 2 +- db/fixtures/500_lounge_category.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/serializers/category_serializer.rb b/app/serializers/category_serializer.rb index beb7ae1d07b..f482dd7e13d 100644 --- a/app/serializers/category_serializer.rb +++ b/app/serializers/category_serializer.rb @@ -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 diff --git a/db/fixtures/500_lounge_category.rb b/db/fixtures/500_lounge_category.rb index 83d8eb5cf24..5fa93ddb1e6 100644 --- a/db/fixtures/500_lounge_category.rb +++ b/db/fixtures/500_lounge_category.rb @@ -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']