FIX: ensures user has groups

FIX: ensures user has groups

diff --git a/assets/javascripts/discourse/components/group-reports-nav-item.js.es6 b/assets/javascripts/discourse/components/group-reports-nav-item.js.es6
index 6280436..04c3d9c 100644
--- a/assets/javascripts/discourse/components/group-reports-nav-item.js.es6
+++ b/assets/javascripts/discourse/components/group-reports-nav-item.js.es6
@@ -12,10 +12,13 @@ export default Ember.Component.extend({
 
   init(args) {
     this.set("group", args.group);
-    if (this.currentUser.groups.some(g => g.id === this.group.id)) {
+    if (
+      (this.get("currentUser.groups") || []).some(g => g.id === this.group.id)
+    ) {
       // User is a part of the group. Now check if the group has reports
       this.checkForReports();
     }
+
     this._super(args);
   }
 });

GitHub sha: 844f96d1

1 Like