Skip to content

A platform for community discussion. Free, open, simple.

DEV: Extract out compound conditional (#13008)

Blake Ericksonee880c4c8997
diff --git a/app/models/category.rb b/app/models/category.rb
index 315a4fa2b35..e2c6edc9d4b 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -785,7 +785,7 @@ class Category < ActiveRecord::Base
end
def update_reviewables
- if SiteSetting.enable_category_group_moderation? && saved_change_to_reviewable_by_group_id?
+ if should_update_reviewables?
Reviewable.where(category_id: id).update_all(reviewable_by_group_id: reviewable_by_group_id)
end
end
@@ -914,6 +914,10 @@ class Category < ActiveRecord::Base
private
+ def should_update_reviewables?
+ SiteSetting.enable_category_group_moderation? && saved_change_to_reviewable_by_group_id?
+ end
+
def check_permissions_compatibility(parent_permissions, child_permissions)
parent_groups = parent_permissions.map(&:first)