From 16d58c665c878cd77e6c4c080c46000f55bb7aba Mon Sep 17 00:00:00 2001 From: David Taylor Date: Fri, 29 Nov 2024 15:39:49 +0000 Subject: [PATCH] DEV: Convert to native class syntax (#41) --- .../components/topic-in-gated-category.js | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/javascripts/discourse/components/topic-in-gated-category.js b/javascripts/discourse/components/topic-in-gated-category.js index 0458856..2e2d130 100644 --- a/javascripts/discourse/components/topic-in-gated-category.js +++ b/javascripts/discourse/components/topic-in-gated-category.js @@ -1,4 +1,5 @@ import Component from "@ember/component"; +import { tagName } from "@ember-decorators/component"; import discourseComputed from "discourse-common/utils/decorators"; const enabledCategories = settings.enabled_categories @@ -8,24 +9,24 @@ const enabledCategories = settings.enabled_categories const enabledTags = settings.enabled_tags.split("|").filter(Boolean); -export default Component.extend({ - tagName: "", - hidden: true, +@tagName("") +export default class TopicInGatedCategory extends Component { + hidden = true; didInsertElement() { - this._super(...arguments); + super.didInsertElement(...arguments); this.recalculate(); - }, + } didUpdateAttrs() { - this._super(...arguments); + super.didUpdateAttrs(...arguments); this.recalculate(); - }, + } willDestroyElement() { - this._super(...arguments); + super.willDestroyElement(...arguments); document.body.classList.remove("topic-in-gated-category"); - }, + } recalculate() { // do nothing if: @@ -46,10 +47,10 @@ export default Component.extend({ document.body.classList.add("topic-in-gated-category"); this.set("hidden", false); } - }, + } @discourseComputed("hidden") shouldShow(hidden) { return !hidden; - }, -}); + } +}