DEV: Include deprecation link in warning banner (#25839)
This commit is contained in:
parent
1ac8922013
commit
20a36f0b8f
|
@ -58,10 +58,10 @@ export default class DeprecationWarningHandler extends Service {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.maybeNotifyAdmin(opts.id, source);
|
this.maybeNotifyAdmin(opts, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
maybeNotifyAdmin(id, source) {
|
maybeNotifyAdmin(opts, source) {
|
||||||
if (this.#adminWarned) {
|
if (this.#adminWarned) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -74,17 +74,26 @@ export default class DeprecationWarningHandler extends Service {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CRITICAL_DEPRECATIONS.some((pattern) => pattern.test(id))) {
|
if (CRITICAL_DEPRECATIONS.some((pattern) => pattern.test(opts.id))) {
|
||||||
this.notifyAdmin(id, source);
|
this.notifyAdmin(opts, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyAdmin(id, source) {
|
notifyAdmin({ id, url }, source) {
|
||||||
this.#adminWarned = true;
|
this.#adminWarned = true;
|
||||||
|
|
||||||
let notice = I18n.t("critical_deprecation.notice", {
|
let notice = I18n.t("critical_deprecation.notice") + " ";
|
||||||
id: escapeExpression(id),
|
|
||||||
});
|
if (url) {
|
||||||
|
notice += I18n.t("critical_deprecation.linked_id", {
|
||||||
|
id: escapeExpression(id),
|
||||||
|
url: escapeExpression(url),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
notice += I18n.t("critical_deprecation.id", {
|
||||||
|
id: escapeExpression(id),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (this.siteSettings.warn_critical_js_deprecations_message) {
|
if (this.siteSettings.warn_critical_js_deprecations_message) {
|
||||||
notice += " " + this.siteSettings.warn_critical_js_deprecations_message;
|
notice += " " + this.siteSettings.warn_critical_js_deprecations_message;
|
||||||
|
|
|
@ -226,7 +226,9 @@ en:
|
||||||
broken_plugin_alert: "Caused by plugin '%{name}'"
|
broken_plugin_alert: "Caused by plugin '%{name}'"
|
||||||
|
|
||||||
critical_deprecation:
|
critical_deprecation:
|
||||||
notice: "<b>[Admin Notice]</b> One of your themes or plugins needs updating for compatibility with upcoming Discourse core changes (id:<em>%{id}</em>)."
|
notice: "<b>[Admin Notice]</b> One of your themes or plugins needs updating for compatibility with upcoming Discourse core changes."
|
||||||
|
id: "(id:<em>%{id}</em>)"
|
||||||
|
linked_id: "(id:<a href='%{url}' target='_blank'><em>%{id}</em></a>)"
|
||||||
theme_source: "Identified theme: <a target='_blank' href='%{path}'>'%{name}'</a>."
|
theme_source: "Identified theme: <a target='_blank' href='%{path}'>'%{name}'</a>."
|
||||||
plugin_source: "Identified plugin: '%{name}'"
|
plugin_source: "Identified plugin: '%{name}'"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue