DEV: Extract out compound conditional (#13008)

This commit is contained in:
Blake Erickson 2021-05-10 11:11:51 -06:00 committed by GitHub
parent d4b5a81b05
commit ee880c4c89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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)