A platform for community discussion. Free, open, simple.
FIX: Serialize parent categories first (#26294)
Bianca Nenciua6e06915c427
diff --git a/app/models/topic_list.rb b/app/models/topic_list.rbindex 6c2fbc776ca..9578eb11310 100644--- a/app/models/topic_list.rb+++ b/app/models/topic_list.rb@@ -77,7 +77,7 @@ class TopicListdef categories@categories ||=- topics.map { |t| [t.category&.parent_category, t.category] }.uniq.flatten.compact+ topics.map { |t| [t.category&.parent_category, t.category] }.flatten.uniq.compactenddef load_topicsdiff --git a/lib/topic_view.rb b/lib/topic_view.rbindex d52c9f0c37b..1b8ab6eb140 100644--- a/lib/topic_view.rb+++ b/lib/topic_view.rb@@ -727,9 +727,9 @@ class TopicViewenddef categories- categories = [category, category&.parent_category]- categories += suggested_topics.categories if suggested_topics- categories.compact.uniq+ @categories ||= [category&.parent_category, category, suggested_topics&.categories].flatten+ .uniq+ .compactendprotected