From 0ed4c452d014eb0a15852f00a9f8e4e709df422b Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 23 Dec 2024 00:55:49 +0100 Subject: [PATCH] DEV: Convert CategoryReadOnlyBanner to gjs (#30412) --- .../components/category-read-only-banner.gjs | 25 +++++++++++++++++++ .../components/category-read-only-banner.hbs | 7 ------ .../components/category-read-only-banner.js | 12 --------- 3 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 app/assets/javascripts/discourse/app/components/category-read-only-banner.gjs delete mode 100644 app/assets/javascripts/discourse/app/components/category-read-only-banner.hbs delete mode 100644 app/assets/javascripts/discourse/app/components/category-read-only-banner.js diff --git a/app/assets/javascripts/discourse/app/components/category-read-only-banner.gjs b/app/assets/javascripts/discourse/app/components/category-read-only-banner.gjs new file mode 100644 index 00000000000..3530b4e0e44 --- /dev/null +++ b/app/assets/javascripts/discourse/app/components/category-read-only-banner.gjs @@ -0,0 +1,25 @@ +import Component from "@glimmer/component"; +import { service } from "@ember/service"; +import { htmlSafe } from "@ember/template"; + +export default class CategoryReadOnlyBanner extends Component { + @service currentUser; + + get shouldShow() { + return ( + this.args.category?.read_only_banner && + this.args.readOnly && + this.currentUser + ); + } + + +} diff --git a/app/assets/javascripts/discourse/app/components/category-read-only-banner.hbs b/app/assets/javascripts/discourse/app/components/category-read-only-banner.hbs deleted file mode 100644 index 50f83b08094..00000000000 --- a/app/assets/javascripts/discourse/app/components/category-read-only-banner.hbs +++ /dev/null @@ -1,7 +0,0 @@ -{{#if this.shouldShow}} -
-
- {{html-safe this.category.read_only_banner}} -
-
-{{/if}} \ No newline at end of file diff --git a/app/assets/javascripts/discourse/app/components/category-read-only-banner.js b/app/assets/javascripts/discourse/app/components/category-read-only-banner.js deleted file mode 100644 index 495409e4780..00000000000 --- a/app/assets/javascripts/discourse/app/components/category-read-only-banner.js +++ /dev/null @@ -1,12 +0,0 @@ -import Component from "@ember/component"; -import { and } from "@ember/object/computed"; -import discourseComputed from "discourse-common/utils/decorators"; - -export default class CategoryReadOnlyBanner extends Component { - @and("category.read_only_banner", "readOnly", "user") shouldShow; - - @discourseComputed - user() { - return this.currentUser; - } -}