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

This commit is contained in:
Robin Ward 2020-07-21 12:10:24 -04:00
parent 531793e98f
commit 9dd6367d81
2 changed files with 7 additions and 3 deletions

View File

@ -83,7 +83,7 @@ class DecoratorHelper {
* ``` * ```
**/ **/
cooked(cooked) { cooked(cooked) {
return new PostCooked({ cooked }); return new PostCooked({ cooked }, this);
} }
/** /**

View File

@ -93,8 +93,12 @@ export default class PostCooked {
} }
_fixImageSizes($html) { _fixImageSizes($html) {
const maxImageWidth = Discourse.SiteSettings.max_image_width; if (!this.decoratorHelper || !this.decoratorHelper.widget) {
const maxImageHeight = Discourse.SiteSettings.max_image_height; return;
}
let siteSettings = this.decoratorHelper.widget.siteSettings;
const maxImageWidth = siteSettings.max_image_width;
const maxImageHeight = siteSettings.max_image_height;
let maxWindowWidth; let maxWindowWidth;
$html.find("img:not(.avatar)").each((idx, img) => { $html.find("img:not(.avatar)").each((idx, img) => {