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.
This commit is contained in:
Bianca Nenciu 2024-03-27 18:44:02 +02:00 committed by GitHub
parent cde34fb316
commit d8d7bbb778
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -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) {