diff --git a/app/models/topic_list.rb b/app/models/topic_list.rb index 9fbc99142a8..efa8089202b 100644 --- a/app/models/topic_list.rb +++ b/app/models/topic_list.rb @@ -46,8 +46,6 @@ class TopicList if @opts[:category] @category = Category.find_by(id: @opts[:category_id]) end - - preloaded_custom_fields << DiscourseTagging::TAGS_FIELD_NAME if SiteSetting.tagging_enabled end def tags diff --git a/lib/topic_query.rb b/lib/topic_query.rb index 741d63d51cf..a7ed2ececfc 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -787,10 +787,12 @@ class TopicQuery end def base_messages - Topic + query = Topic .where('topics.archetype = ?', Archetype.private_message) .joins("LEFT JOIN topic_users tu ON topics.id = tu.topic_id AND tu.user_id = #{@user.id.to_i}") - .order('topics.bumped_at DESC') + + query = query.includes(:tags) if SiteSetting.tagging_enabled + query.order('topics.bumped_at DESC') end def random_suggested(topic, count, excluded_topic_ids=[])