FIX: Allow category moderators to move topics to their categories (#20896)

This commit is contained in:
Natalie Tay
2023-10-03 17:59:16 +08:00
committed by GitHub
parent 62694e076e
commit 70be873b9c
5 changed files with 157 additions and 4 deletions

View File

@@ -73,4 +73,13 @@ module CategoryGuardian
@topic_featured_link_allowed_category_ids =
Category.where(topic_featured_link_allowed: true).pluck(:id)
end
def topics_need_approval?(category)
return false if is_admin?
return category.require_topic_approval? if !SiteSetting.enable_category_group_moderation
return category.require_topic_approval? if category.reviewable_by_group_id.nil?
if category.reviewable_by_group_id
!self.user.belonging_to_group_ids.include?(category.reviewable_by_group_id)
end
end
end

View File

@@ -70,8 +70,7 @@ module TopicGuardian
Category.find(category || SiteSetting.uncategorized_category_id)
end
)
is_staff? || (can_create_topic_on_category?(category) && !category.require_topic_approval?)
is_staff? || can_create_topic_on_category?(category) && !topics_need_approval?(category)
end
def can_create_post_on_topic?(topic)