mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Previously thumbnails were only preloaded for queries using `TopicQuery#default_results`, which meant that requests for PM topic lists would lead to N+1 queries. This commit moves the preloading into TopicList#load_topics, along with other similar preloads (e.g. plugin custom fields) The direct call to `ActiveRecord::Associations::Preloader#preload` is necessary because `@topics` can be an array, not an `ActiveRecord::Relation`