FIX: js error when no group_timezones exist

FIX: js error when no group_timezones exist

When no users have timezone set, then post.group_timezones will not exist, resulting in Uncaught TypeError: o.group_timezones is undefined.

diff --git a/assets/javascripts/initializers/discourse-group-timezones.js.es6 b/assets/javascripts/initializers/discourse-group-timezones.js.es6
index b988aa0..c199c16 100644
--- a/assets/javascripts/initializers/discourse-group-timezones.js.es6
+++ b/assets/javascripts/initializers/discourse-group-timezones.js.es6
@@ -37,7 +37,7 @@ export default {
             throw "[group] attribute is necessary when using timezones.";
           }
 
-          const members = post.group_timezones[group] || [];
+          const members = (post.get("group_timezones") || {})[group] || [];
 
           _attachWidget(groupTimezone, {
             id: `${post.id}-${idx}`,

GitHub sha: 7befc72a

1 Like