From d8d7bbb778131e538a248db1088997afb3fd2111 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 27 Mar 2024 18:44:02 +0200 Subject: [PATCH] DEV: Prefer Category.findById over categoryById (#285) Category.findById should be used over site.categoryById map because that is an implementation detail that might be removed in the future. --- assets/javascripts/discourse/components/query-result.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/components/query-result.js b/assets/javascripts/discourse/components/query-result.js index 49929e0..4d1a926 100644 --- a/assets/javascripts/discourse/components/query-result.js +++ b/assets/javascripts/discourse/components/query-result.js @@ -6,6 +6,7 @@ import { inject as service } from "@ember/service"; import { capitalize } from "@ember/string"; import { ajax } from "discourse/lib/ajax"; import Badge from "discourse/models/badge"; +import Category from "discourse/models/category"; import getURL from "discourse-common/lib/get-url"; import I18n from "I18n"; import BadgeViewComponent from "./result-types/badge"; @@ -199,7 +200,7 @@ export default class QueryResult extends Component { } lookupCategory(id) { - return this.site.categoriesById[id]; + return Category.findById(id); } _cutChartLabel(label) {