Skip to content

Commit aa2a0c1

Browse files
authored
DEV: Silence post-stream-widget-overrides in the checklist plugin (#33743)
Wraps the post widget lookup in `withSilencedDeprecations` to suppress noisy `post-stream-widget-overrides` warnings when the checklist plugin accesses the legacy post stream widget. The deprecation warning was being triggered when incompatible extensions forced the use of the legacy widget post-stream, even though the code already properly handles the Glimmer Post Stream case. This change maintains the existing functionality while eliminating unnecessary console noise.
1 parent 8fea4ea commit aa2a0c1

File tree

1 file changed

+10
-5
lines changed
  • plugins/checklist/assets/javascripts/discourse/initializers

1 file changed

+10
-5
lines changed

plugins/checklist/assets/javascripts/discourse/initializers/checklist.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ajax } from "discourse/lib/ajax";
22
import { popupAjaxError } from "discourse/lib/ajax-error";
3+
import { withSilencedDeprecations } from "discourse/lib/deprecated";
34
import { getOwnerWithFallback } from "discourse/lib/get-owner";
45
import { iconHTML } from "discourse/lib/icon-library";
56
import { withPluginApi } from "discourse/lib/plugin-api";
@@ -58,13 +59,17 @@ export function checklistSyntax(elem, postDecorator) {
5859
const boxes = [...elem.getElementsByClassName("chcklst-box")];
5960
addUlClasses(boxes);
6061

61-
// TODO (glimmer-post-stream): remove this when we remove the legacy post stream code
62-
const postWidget = getOwnerWithFallback(this).lookup("service:site")
63-
.useGlimmerPostStream
64-
? null
65-
: postDecorator?.widget;
6662
const postModel = postDecorator?.getModel();
6763

64+
// TODO (glimmer-post-stream): remove this when we remove the legacy post stream code
65+
const postWidget = withSilencedDeprecations(
66+
"discourse.post-stream-widget-overrides",
67+
() =>
68+
getOwnerWithFallback(this).lookup("service:site").useGlimmerPostStream
69+
? null
70+
: postDecorator?.widget
71+
);
72+
6873
if (!postModel?.can_edit) {
6974
return;
7075
}

0 commit comments

Comments
 (0)