Get membership status only for the current group

Closes #575

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-03-05 11:23:17 +01:00
parent 74923c91d8
commit 03824b898c
11 changed files with 161 additions and 67 deletions

View File

@@ -628,15 +628,14 @@ export default class Group extends mixins(GroupMixin) {
}
get groupMember(): IMember | undefined {
if (!this.person || !this.person.id) return undefined;
return this.person.memberships.elements.find(
({ parent: { id } }) => id === this.group.id
);
if (this.person?.memberships?.total > 0) {
return this.person?.memberships?.elements[0];
}
return undefined;
}
get groupMemberships(): (string | undefined)[] {
if (!this.person || !this.person.id) return [];
return this.person.memberships.elements
return this.person?.memberships?.elements
.filter(
(membership: IMember) =>
![