mirror of
https://github.com/discourse/discourse.git
synced 2024-11-21 16:38:15 -06:00
FIX: Handle deprecations correctly in server-side pretty-text (#25059)
`window.deprecationWorkflow` does not exist in the server-side pretty-text environment. This commit fixes the check and adds a general spec for deprecations triggered inside pretty-text
This commit is contained in:
parent
8e58c6dd93
commit
48ad326ba4
@ -52,7 +52,7 @@ export default function deprecated(msg, options = {}) {
|
||||
if (
|
||||
raiseError ||
|
||||
matchedWorkflow?.handler === "throw" ||
|
||||
(!matchedWorkflow && deprecationWorkflow.throwOnUnhandled)
|
||||
(!matchedWorkflow && deprecationWorkflow?.throwOnUnhandled)
|
||||
) {
|
||||
throw msg;
|
||||
}
|
||||
|
@ -2681,4 +2681,16 @@ HTML
|
||||
|
||||
expect(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
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user