From 28bfc31b01ed7b8d49b9c98007ff1b6facc4b68f Mon Sep 17 00:00:00 2001
From: Thomas Citharel <tcit@tcit.fr>
Date: Tue, 16 Mar 2021 17:36:30 +0100
Subject: [PATCH] Fix accessing group profile when not member

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
---
 js/src/mixins/group.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/js/src/mixins/group.ts b/js/src/mixins/group.ts
index 86ec8bbdf..4003ecf22 100644
--- a/js/src/mixins/group.ts
+++ b/js/src/mixins/group.ts
@@ -84,7 +84,10 @@ export default class GroupMixin extends Vue {
 
   hasCurrentActorThisRole(givenRole: string | string[]): boolean {
     const roles = Array.isArray(givenRole) ? givenRole : [givenRole];
-    return roles.includes(this.person?.memberships?.elements[0].role);
+    return (
+      this.person?.memberships?.total > 0 &&
+      roles.includes(this.person?.memberships?.elements[0].role)
+    );
   }
 
   handleErrors(errors: any[]): void {