DEV: Use the new `owner` arg in `shouldRender` (#314)

This commit is contained in:
Jarek Radosz 2024-10-31 10:56:06 +01:00 committed by GitHub
parent 7d2a0274f9
commit c2f549fd4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 5 deletions

View File

@ -1,7 +1,6 @@
import Component from "@glimmer/component"; import Component from "@glimmer/component";
import { action } from "@ember/object"; import { action } from "@ember/object";
import { inject as service } from "@ember/service"; import { inject as service } from "@ember/service";
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
import I18n from "I18n"; import I18n from "I18n";
const QUERY_PARAM_VALUES = { const QUERY_PARAM_VALUES = {
@ -16,17 +15,17 @@ const UX_VALUES = {
}; };
export default class SolvedStatusFilter extends Component { export default class SolvedStatusFilter extends Component {
static shouldRender(args, helper) { static shouldRender(args, context, owner) {
const router = getOwnerWithFallback(this).lookup("service:router"); const router = owner.lookup("service:router");
if ( if (
!helper.siteSettings.show_filter_by_solved_status || !context.siteSettings.show_filter_by_solved_status ||
router.currentRouteName === "discovery.categories" || router.currentRouteName === "discovery.categories" ||
args.editingCategory args.editingCategory
) { ) {
return false; return false;
} else if ( } else if (
helper.siteSettings.allow_solved_on_all_topics || context.siteSettings.allow_solved_on_all_topics ||
router.currentRouteName === "tag.show" router.currentRouteName === "tag.show"
) { ) {
return true; return true;