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).
This commit is contained in:
David Taylor 2024-07-02 15:01:41 +01:00 committed by GitHub
parent 53e150716e
commit 0a72b21e8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 // 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. // not being triggered by core or official themes/plugins.
export const CRITICAL_DEPRECATIONS = [ export const CRITICAL_DEPRECATIONS = [
/^discourse.modal-controllers$/, "discourse.modal-controllers",
/^discourse.bootbox$/, "discourse.bootbox",
/^discourse.add-header-panel$/, "discourse.add-header-panel",
/^discourse.header-widget-overrides$/, "discourse.header-widget-overrides",
"discourse.plugin-outlet-tag-name",
"discourse.plugin-outlet-parent-view",
/^(?!discourse\.)/, // All unsilenced ember deprecations /^(?!discourse\.)/, // All unsilenced ember deprecations
]; ];
@ -76,7 +78,15 @@ export default class DeprecationWarningHandler extends Service {
return; 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); this.notifyAdmin(opts, source);
} }
} }