Skip to content

A platform for community discussion. Free, open, simple.

FIX: `decoratorHelper.widget` is not always present

Robin Wardb005a845301f
diff --git a/app/assets/javascripts/discourse/widgets/post-cooked.js.es6 b/app/assets/javascripts/discourse/widgets/post-cooked.js.es6
index f28f1f6e0d8..e0541dc4cef 100644
--- a/app/assets/javascripts/discourse/widgets/post-cooked.js.es6
+++ b/app/assets/javascripts/discourse/widgets/post-cooked.js.es6
@@ -16,8 +16,14 @@ export default class PostCooked {
this.attrs = attrs;
this.expanding = false;
this._highlighted = false;
- this.decoratorHelper = decoratorHelper;
- this.currentUser = decoratorHelper.widget.currentUser;
+
+ if (decoratorHelper) {
+ this.decoratorHelper = decoratorHelper;
+ if (decoratorHelper.widget && decoratorHelper.currentUser) {
+ this.currentUser = decoratorHelper.currentUser;
+ }
+ }
+
this.ignoredUsers = this.currentUser
? this.currentUser.ignored_users
: null;