Skip to content

A platform for community discussion. Free, open, simple.

DEV: Remove deprecated hbs support from CustomHtml (#37391)

Jarek Radosz513c09ebe303
diff --git a/frontend/discourse/app/components/custom-html.js b/frontend/discourse/app/components/custom-html.js
index 3aa7fb4598a..3c7b330e07a 100644
--- a/frontend/discourse/app/components/custom-html.js
+++ b/frontend/discourse/app/components/custom-html.js
@@ -1,9 +1,7 @@
/* eslint-disable ember/no-classic-components */
import Component from "@ember/component";
-import { getOwner } from "@ember/owner";
import { hbs } from "ember-cli-htmlbars";
import { getCustomHTML } from "discourse/helpers/custom-html";
-import deprecated from "discourse/lib/deprecated";
export default class CustomHtml extends Component {
triggerAppEvent = null;
@@ -16,15 +14,6 @@ export default class CustomHtml extends Component {
if (html) {
this.set("html", html);
this.set("layout", hbs`{{this.html}}`);
- } else {
- const template = getOwner(this).lookup(`template:${name}`);
- if (template) {
- deprecated(
- "Defining an hbs template for CustomHTML rendering is deprecated. Use plugin outlets instead.",
- { id: "discourse.custom_html_template" }
- );
- this.set("layout", template);
- }
}
}
diff --git a/frontend/discourse/tests/acceptance/custom-html-set-test.js b/frontend/discourse/tests/acceptance/custom-html-set-test.js
index 48708e95180..afda09e2c41 100644
--- a/frontend/discourse/tests/acceptance/custom-html-set-test.js
+++ b/frontend/discourse/tests/acceptance/custom-html-set-test.js
@@ -14,9 +14,7 @@ acceptance("CustomHTML set", function () {
setCustomHTML("top", '<span class="custom-html-test">HTML</span>');
await visit("/static/faq");
- assert
- .dom("span.custom-html-test")
- .hasText("HTML", "it inserted the markup");
+ assert.dom("span.custom-html-test").hasText("HTML", "inserted the markup");
});
test("renders preloaded HTML", async function (assert) {
@@ -25,6 +23,6 @@ acceptance("CustomHTML set", function () {
});
await visit("/static/faq");
- assert.dom("span.cookie").hasText("monster", "it inserted the markup");
+ assert.dom("span.cookie").hasText("monster", "inserted the markup");
});
});
diff --git a/frontend/discourse/tests/acceptance/custom-html-template-test.js b/frontend/discourse/tests/acceptance/custom-html-template-test.js
deleted file mode 100644
index e42c6b17c77..00000000000
--- a/frontend/discourse/tests/acceptance/custom-html-template-test.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import { visit } from "@ember/test-helpers";
-import { hbs } from "ember-cli-htmlbars";
-import { test } from "qunit";
-import { withSilencedDeprecationsAsync } from "discourse/lib/deprecated";
-import { acceptance } from "discourse/tests/helpers/qunit-helpers";
-import { registerTemporaryModule } from "discourse/tests/helpers/temporary-module-helper";
-
-acceptance("CustomHTML template", function (needs) {
- needs.hooks.beforeEach(() => {
- registerTemporaryModule(
- "discourse/templates/top",
- hbs`<span class='top-span'>TOP</span>`
- );
- });
-
- test("renders custom template", async function (assert) {
- await withSilencedDeprecationsAsync(
- "discourse.custom_html_template",
- async () => {
- await visit("/static/faq");
- assert.dom("span.top-span").hasText("TOP", "inserted the template");
- }
- );
- });
-});