Skip to content

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

DEV: Disable widgets by default (#35504)

Sérgio Saquetima138e253338c
diff --git a/app/assets/javascripts/discourse/app/widgets/render-glimmer.js b/app/assets/javascripts/discourse/app/widgets/render-glimmer.js
index 0dae2e79eb8..9f5852e885f 100644
--- a/app/assets/javascripts/discourse/app/widgets/render-glimmer.js
+++ b/app/assets/javascripts/discourse/app/widgets/render-glimmer.js
@@ -222,9 +222,8 @@ export function registerWidgetShim(name, tagName, template) {
?.deactivate_widgets_rendering
) {
warnWidgetsDeprecation(
- `Widgets are deactivated and shims can't be registered. Your site may not work properly. Affected widget: ${name}.`
+ `Widgets are deactivated. Your site may not work properly. Affected widget: ${name}.`
);
- return;
} else {
warnWidgetsDeprecation(
`Using \`registerWidgetShim\` is deprecated and will soon stop working. Affected widgetShim: ${name}.`
diff --git a/app/assets/javascripts/discourse/app/widgets/widget.js b/app/assets/javascripts/discourse/app/widgets/widget.js
index 532d2f660d7..7f2f2bb662b 100644
--- a/app/assets/javascripts/discourse/app/widgets/widget.js
+++ b/app/assets/javascripts/discourse/app/widgets/widget.js
@@ -142,9 +142,8 @@ export function createWidget(name, opts) {
?.deactivate_widgets_rendering
) {
warnWidgetsDeprecation(
- `Widgets are deactivated and can't be created. Your site may not work properly. Affected widget: ${name}.`
+ `Widgets are deactivated. Your site may not work properly. Affected widget: ${name}.`
);
- return;
} else {
warnWidgetsDeprecation(
`Using \`api.createWidget\` is deprecated and will soon stop working. Use Glimmer components instead. Affected widget: ${name}.`
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.gjs
index 07563bdb15f..2ba3cc389cb 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/actions-summary-test.gjs
@@ -9,6 +9,8 @@ module("Integration | Component | Widget | actions-summary", function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+
const store = getOwner(this).lookup("service:store");
const topic = store.createRecord("topic", { id: 123 });
const post = store.createRecord("post", {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/avatar-flair-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/avatar-flair-test.gjs
index 7776c2a939f..6836cd807f7 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/avatar-flair-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/avatar-flair-test.gjs
@@ -6,6 +6,10 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";
module("Integration | Component | Widget | avatar-flair", function (hooks) {
setupRenderingTest(hooks);
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
test("avatar flair with an icon", async function (assert) {
const args = {
flair_url: "bars",
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs
index cb05ca4bf73..3ab59c28d7c 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/button-test.gjs
@@ -6,6 +6,10 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";
module("Integration | Component | Widget | button", function (hooks) {
setupRenderingTest(hooks);
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
test("icon only button", async function (assert) {
const self = this;
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-cooked-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-cooked-test.gjs
index 4e62322ec35..69e1997d7c2 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-cooked-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-cooked-test.gjs
@@ -10,6 +10,10 @@ import { createWidget } from "discourse/widgets/widget";
module("Integration | Component | Widget | post-cooked", function (hooks) {
setupRenderingTest(hooks);
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
test("quotes with no username and no valid topic", async function (assert) {
const args = {
cooked: `<aside class=\"quote no-group quote-post-not-found\" data-post=\"1\" data-topic=\"123456\">\n<blockquote>\n<p>abcd</p>\n</blockquote>\n</aside>\n<p>Testing the issue</p>`,
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.gjs
index ad4ceaba48c..2e4f82f0b6d 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-links-test.gjs
@@ -7,6 +7,10 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";
module("Integration | Component | Widget | post-links", function (hooks) {
setupRenderingTest(hooks);
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
test("duplicate links", async function (assert) {
const args = {
id: 2,
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.gjs
index b775d343b00..01e0ece4abf 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-small-action-test.gjs
@@ -15,6 +15,7 @@ module(
hooks.beforeEach(function () {
this.siteSettings.glimmer_post_stream_mode = "disabled";
+ this.siteSettings.deactivate_widgets_rendering = false;
});
test("does not have delete/edit/recover buttons by default", async function (assert) {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.gjs
index 17f058dd4fe..498bd761c02 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-stream-test.gjs
@@ -29,6 +29,7 @@ function postStreamTest(name, attrs) {
hooks.beforeEach(function () {
this.siteSettings.glimmer_post_stream_mode = postStreamMode;
+ this.siteSettings.deactivate_widgets_rendering = false;
});
const CustomPostMenuButton = <template>
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.gjs
index f382054b876..e9154027042 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/post-test.gjs
@@ -12,6 +12,7 @@ module("Integration | Component | Widget | post", function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
this.siteSettings.post_menu_hidden_items = "";
const store = getOwner(this).lookup("service:store");
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-test.gjs
index d825a3817e8..3974e40f8ad 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/poster-name-test.gjs
@@ -10,6 +10,7 @@ module("Integration | Component | Widget | poster-name", function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
this.siteSettings.glimmer_post_stream_mode = "disabled";
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js
index 00cd3406d89..43358b249b7 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js
@@ -132,6 +132,8 @@ module("Integration | Component | Widget | render-glimmer", function (hooks) {
setupRenderingTest(hooks);
hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+
DemoComponent.eventLog = [];
DemoWidget.actionTriggered = false;
this.registry.register("widget:demo-widget", DemoWidget);
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-test.gjs
index da69d98c548..703cdc52a93 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/small-user-list-test.gjs
@@ -7,6 +7,10 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";
module("Integration | Component | Widget | small-user-list", function (hooks) {
setupRenderingTest(hooks);
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
test("renders avatars and support for unknown", async function (assert) {
const args = {
users: [
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs
index 4c84bb013cd..ee87998f209 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/topic-status-test.gjs
@@ -7,6 +7,10 @@ import { setupRenderingTest } from "discourse/tests/helpers/component-test";
module("Integration | Component | Widget | topic-status", function (hooks) {
setupRenderingTest(hooks);
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
test("basics", async function (assert) {
const store = getOwner(this).lookup("service:store");
const args = {
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs
index c315dbbdf2a..eea9656bb20 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-dropdown-test.gjs
@@ -22,6 +22,10 @@ module("Integration | Component | Widget | widget-dropdown", function (hooks) {
let _translations = I18n.translations;
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
hooks.afterEach(function () {
I18n.translations = _translations;
});
diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.gjs b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.gjs
index 5e7acce777e..54b336d819c 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.gjs
+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/widget-test.gjs
@@ -15,6 +15,10 @@ module("Integration | Component | Widget | base", function (hooks) {
let _translations = I18n.translations;
+ hooks.beforeEach(function () {
+ this.siteSettings.deactivate_widgets_rendering = false;
+ });
+
hooks.afterEach(function () {
I18n.translations = _translations;
});
diff --git a/app/assets/javascripts/discourse/tests/setup-tests.js b/app/assets/javascripts/discourse/tests/setup-tests.js
index 8f01457e3ac..8d209cf99f2 100644
--- a/app/assets/javascripts/discourse/tests/setup-tests.js
+++ b/app/assets/javascripts/discourse/tests/setup-tests.js
@@ -271,6 +271,7 @@ export default function setupTests(config) {
let app;
QUnit.testStart(function (ctx) {
let settings = resetSettings();
+
resetThemeSettings();
app = createApplication(config, settings);
diff --git a/config/site_settings.yml b/config/site_settings.yml
index 750a2961866..442ad28a6bb 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -4238,11 +4238,11 @@ experimental:
- disabled
- auto
- enabled
- default: "auto"
+ default: "enabled"
area: "experimental"
deactivate_widgets_rendering:
client: true
- default: false
+ default: true
area: "experimental"
enable_rich_text_paste:
client: true