Handle topics without categories

This commit is contained in:
jbrw 2020-07-28 17:55:24 -04:00
parent f25fa83b6d
commit 17ab69929c
No known key found for this signature in database
GPG Key ID: FAFF7D94CE3F957B

View File

@ -431,7 +431,7 @@ class TopicView
def category_group_moderator_user_ids
@category_group_moderator_user_ids ||= begin
if SiteSetting.enable_category_group_moderation? && @topic.category.reviewable_by_group.present?
if SiteSetting.enable_category_group_moderation? && @topic.category&.reviewable_by_group&.present?
posts_user_ids = Set.new(@posts.map(&:user_id))
Set.new(
@topic.category.reviewable_by_group.group_users.where(user_id: posts_user_ids).pluck('distinct user_id')