REFACTOR: Remove `Discourse.SiteSettings` from `PostCooked` widget

REFACTOR: Remove Discourse.SiteSettings from PostCooked widget

diff --git a/app/assets/javascripts/discourse/app/widgets/decorator-helper.js b/app/assets/javascripts/discourse/app/widgets/decorator-helper.js
index dfecfd8..7c67d99 100644
--- a/app/assets/javascripts/discourse/app/widgets/decorator-helper.js
+++ b/app/assets/javascripts/discourse/app/widgets/decorator-helper.js
@@ -83,7 +83,7 @@ class DecoratorHelper {
    * `‍``
    **/
   cooked(cooked) {
-    return new PostCooked({ cooked });
+    return new PostCooked({ cooked }, this);
   }
 
   /**
diff --git a/app/assets/javascripts/discourse/app/widgets/post-cooked.js b/app/assets/javascripts/discourse/app/widgets/post-cooked.js
index 5f5c6e8..0196b0f 100644
--- a/app/assets/javascripts/discourse/app/widgets/post-cooked.js
+++ b/app/assets/javascripts/discourse/app/widgets/post-cooked.js
@@ -93,8 +93,12 @@ export default class PostCooked {
   }
 
   _fixImageSizes($html) {
-    const maxImageWidth = Discourse.SiteSettings.max_image_width;
-    const maxImageHeight = Discourse.SiteSettings.max_image_height;
+    if (!this.decoratorHelper || !this.decoratorHelper.widget) {
+      return;
+    }
+    let siteSettings = this.decoratorHelper.widget.siteSettings;
+    const maxImageWidth = siteSettings.max_image_width;
+    const maxImageHeight = siteSettings.max_image_height;
 
     let maxWindowWidth;
     $html.find("img:not(.avatar)").each((idx, img) => {

GitHub sha: 9dd6367d

This commit appears in #10280 which was merged by eviltrout.