A platform for community discussion. Free, open, simple.
FIX: Handle deprecations correctly in server-side pretty-text (#25059)
David Taylor48ad326ba442
diff --git a/app/assets/javascripts/discourse-common/addon/lib/deprecated.js b/app/assets/javascripts/discourse-common/addon/lib/deprecated.jsindex bce9aebe86b..cb0e670c88e 100644--- a/app/assets/javascripts/discourse-common/addon/lib/deprecated.js+++ b/app/assets/javascripts/discourse-common/addon/lib/deprecated.js@@ -52,7 +52,7 @@ export default function deprecated(msg, options = {}) {if (raiseError ||matchedWorkflow?.handler === "throw" ||- (!matchedWorkflow && deprecationWorkflow.throwOnUnhandled)+ (!matchedWorkflow && deprecationWorkflow?.throwOnUnhandled)) {throw msg;}diff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rbindex 555ef04d3da..1583ef5fecf 100644--- a/spec/lib/pretty_text_spec.rb+++ b/spec/lib/pretty_text_spec.rb@@ -2681,4 +2681,16 @@ HTMLexpect(cooked.strip).to eq(html.strip)end++ it "handles deprecations correctly" do+ Rails+ .logger+ .expects(:warn)+ .once+ .with("[PrettyText] Deprecation notice: Some deprecation message")++ PrettyText.v8.eval <<~JS+ require("discourse-common/lib/deprecated").default("Some deprecation message");+ JS+ endend