From 0a72b21e8f26c958c7e0036e358010ac9bec4aed Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 2 Jul 2024 15:01:41 +0100 Subject: [PATCH] DEV: Add admin warnings for plugin-outlet deprecations (#27679) Adds warnings for: - `discourse.plugin-outlet-tag-name` - `discourse.plugin-outlet-parent-view` Also updates the ID list to be strings rather than regex (so that `.` is not treated as a wildcard). --- .../services/deprecation-warning-handler.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/discourse/app/services/deprecation-warning-handler.js b/app/assets/javascripts/discourse/app/services/deprecation-warning-handler.js index e038b0a0ebc..872cf2d6662 100644 --- a/app/assets/javascripts/discourse/app/services/deprecation-warning-handler.js +++ b/app/assets/javascripts/discourse/app/services/deprecation-warning-handler.js @@ -11,10 +11,12 @@ import I18n from "discourse-i18n"; // To avoid 'crying wolf', we should only add values here when we're sure they're // not being triggered by core or official themes/plugins. export const CRITICAL_DEPRECATIONS = [ - /^discourse.modal-controllers$/, - /^discourse.bootbox$/, - /^discourse.add-header-panel$/, - /^discourse.header-widget-overrides$/, + "discourse.modal-controllers", + "discourse.bootbox", + "discourse.add-header-panel", + "discourse.header-widget-overrides", + "discourse.plugin-outlet-tag-name", + "discourse.plugin-outlet-parent-view", /^(?!discourse\.)/, // All unsilenced ember deprecations ]; @@ -76,7 +78,15 @@ export default class DeprecationWarningHandler extends Service { return; } - if (CRITICAL_DEPRECATIONS.some((pattern) => pattern.test(opts.id))) { + if ( + CRITICAL_DEPRECATIONS.some((pattern) => { + if (typeof pattern === "string") { + return pattern === opts.id; + } else { + return pattern.test(opts.id); + } + }) + ) { this.notifyAdmin(opts, source); } }