main ← tag-preloading
approved 03:05PM - 12 Feb 26 UTC
With `content_localization_enabled`, searching for tags via any tag dropdowns (o…r hashtag autocompletes) triggers a 500 error. The crash occurs because a preloader is called on a non-AR result returned by `DiscourseTagging.filter_allowed_tags` :sadpikachu:, which are plain structs, not AR Tags instances. Additionally, `tag_counts_json` calls AR methods (which access `.locale` that don't exist on the minisql objects.
This PR fixes the issue by converting mini results to Tag ARs with `.includes(:localizations)` before passing them to tag_counts_json.
- TagsController#search
- TagHashtagDataSource#search
- TagHashtagDataSource#search_without_term