Merge branch 'fix-accessing-group-profile-when-not-member' into 'master'

Fix accessing group profile when not member

See merge request framasoft/mobilizon!862
This commit is contained in:
Thomas Citharel 2021-03-16 16:51:23 +00:00
commit 67ced567b1

View file

@ -84,7 +84,10 @@ export default class GroupMixin extends Vue {
hasCurrentActorThisRole(givenRole: string | string[]): boolean { hasCurrentActorThisRole(givenRole: string | string[]): boolean {
const roles = Array.isArray(givenRole) ? givenRole : [givenRole]; 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 { handleErrors(errors: any[]): void {