FIX: hidden was defined as static instead of relying on attribute (#10701)

FIX: hidden was defined as static instead of relying on attribute (#10701)

This commit also:

  • deprecate an old way of using actions for future removal
  • removes all the hidden/block/… logic, as we just rely on parent being displayed or not
diff --git a/app/assets/javascripts/discourse/app/components/composer-message.js b/app/assets/javascripts/discourse/app/components/composer-message.js
index 19eb8fd..21b68a0 100644
--- a/app/assets/javascripts/discourse/app/components/composer-message.js
+++ b/app/assets/javascripts/discourse/app/components/composer-message.js
@@ -1,22 +1,21 @@
+import deprecated from "discourse-common/lib/deprecated";
 import discourseComputed from "discourse-common/utils/decorators";
 import Component from "@ember/component";
 import { getOwner } from "discourse-common/lib/get-owner";
 
 export default Component.extend({
-  classNameBindings: [":composer-popup", ":hidden", "message.extraClass"],
+  classNameBindings: [":composer-popup", "message.extraClass"],
 
   @discourseComputed("message.templateName")
   layout(templateName) {
     return getOwner(this).lookup(`template:composer/${templateName}`);
   },
 
-  didInsertElement() {
-    this._super(...arguments);
-    this.element.style.display = "block";
-  },
-
   actions: {
     closeMessage() {
+      deprecated(
+        'You should use `action=(closeMessage message)` instead of `action=(action "closeMessage")`'
+      );
       this.closeMessage(this.message);
     },
   },
diff --git a/app/assets/javascripts/discourse/app/templates/composer/custom-body.hbs b/app/assets/javascripts/discourse/app/templates/composer/custom-body.hbs
index 50f1253..29edcc8 100644
--- a/app/assets/javascripts/discourse/app/templates/composer/custom-body.hbs
+++ b/app/assets/javascripts/discourse/app/templates/composer/custom-body.hbs
@@ -1,3 +1,3 @@
-<a href {{action "closeMessage"}} class="close">{{d-icon "times"}}</a>
+<a href {{action closeMessage message}} class="close">{{d-icon "times"}}</a>
 {{#if message.title}}<h3>{{message.title}}</h3>{{/if}}
 <p>{{html-safe message.body}}</p>
diff --git a/app/assets/javascripts/discourse/app/templates/composer/education.hbs b/app/assets/javascripts/discourse/app/templates/composer/education.hbs
index ea64441..c3a2300 100644
--- a/app/assets/javascripts/discourse/app/templates/composer/education.hbs
+++ b/app/assets/javascripts/discourse/app/templates/composer/education.hbs
@@ -1,2 +1,2 @@
-<a href {{action "closeMessage"}} class="close">{{d-icon "times"}}</a>
+<a href {{action closeMessage message}} class="close">{{d-icon "times"}}</a>
 {{html-safe message.body}}
diff --git a/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbs b/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbs
index ea64441..c3a2300 100644
--- a/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbs
+++ b/app/assets/javascripts/discourse/app/templates/composer/group-mentioned.hbs
@@ -1,2 +1,2 @@
-<a href {{action "closeMessage"}} class="close">{{d-icon "times"}}</a>
+<a href {{action closeMessage message}} class="close">{{d-icon "times"}}</a>
 {{html-safe message.body}}
diff --git a/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbs b/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbs
index 8a44bb0..eefe388 100644
--- a/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbs
+++ b/app/assets/javascripts/discourse/app/templates/composer/similar-topics.hbs
@@ -1,4 +1,4 @@
-<a href {{action "closeMessage"}} class="close">{{d-icon "times"}}</a>
+<a href {{action closeMessage message}} class="close">{{d-icon "times"}}</a>
 <h3>{{i18n "composer.similar_topics"}}</h3>
 
 <ul class="topics">

GitHub sha: cc2a3069

1 Like

This commit appears in #10701 which was approved by CvX. It was merged by jjaffeux.