DEV: Fix lazy_load_categories for uncategorized topic lists (#24028)

This commit is contained in:
Bianca Nenciu 2023-10-20 13:31:20 +03:00 committed by GitHub
parent 75441e063a
commit e7afd18155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,7 +77,8 @@ class TopicList
end
def categories
@categories ||= topics.map { |t| [t.category, t.category.parent_category] }.uniq.flatten.compact
@categories ||=
topics.map { |t| [t.category, t.category&.parent_category] }.uniq.flatten.compact
end
def load_topics