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) =>
![

View File

@@ -33,14 +33,13 @@
</nav>
<section
class="container section"
v-if="group && isCurrentActorAGroupAdmin"
v-if="group && isCurrentActorAGroupAdmin && followers"
>
<h1>{{ $t("Group Followers") }} ({{ followers.total }})</h1>
<b-field :label="$t('Status')" horizontal>
<b-switch v-model="pending">{{ $t("Pending") }}</b-switch>
</b-field>
<b-table
v-if="followers"
:data="followers.elements"
ref="queueTable"
:loading="this.$apollo.loading"