Get membership status only for the current group
Closes #575 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -75,8 +75,11 @@ import { IActor, IGroup, IPerson, usernameWithDomain } from "@/types/actor";
|
||||
import DiscussionListItem from "@/components/Discussion/DiscussionListItem.vue";
|
||||
import RouteName from "../../router/name";
|
||||
import { MemberRole } from "@/types/enums";
|
||||
import { CURRENT_ACTOR_CLIENT, PERSON_MEMBERSHIPS } from "@/graphql/actor";
|
||||
import { GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED } from "@/graphql/event";
|
||||
import {
|
||||
CURRENT_ACTOR_CLIENT,
|
||||
GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED,
|
||||
PERSON_MEMBERSHIP_GROUP,
|
||||
} from "@/graphql/actor";
|
||||
import { IMember } from "@/types/actor/member.model";
|
||||
import EmptyContent from "@/components/Utils/EmptyContent.vue";
|
||||
|
||||
@@ -96,11 +99,12 @@ import EmptyContent from "@/components/Utils/EmptyContent.vue";
|
||||
},
|
||||
},
|
||||
person: {
|
||||
query: PERSON_MEMBERSHIPS,
|
||||
query: PERSON_MEMBERSHIP_GROUP,
|
||||
fetchPolicy: "cache-and-network",
|
||||
variables() {
|
||||
return {
|
||||
id: this.currentActor.id,
|
||||
group: this.preferredUsername,
|
||||
};
|
||||
},
|
||||
subscribeToMore: {
|
||||
@@ -108,14 +112,21 @@ import EmptyContent from "@/components/Utils/EmptyContent.vue";
|
||||
variables() {
|
||||
return {
|
||||
actorId: this.currentActor.id,
|
||||
group: this.preferredUsername,
|
||||
};
|
||||
},
|
||||
skip() {
|
||||
return !this.currentActor || !this.currentActor.id;
|
||||
return (
|
||||
!this.currentActor ||
|
||||
!this.currentActor.id ||
|
||||
!this.preferredUsername
|
||||
);
|
||||
},
|
||||
},
|
||||
skip() {
|
||||
return !this.currentActor || !this.currentActor.id;
|
||||
return (
|
||||
!this.currentActor || !this.currentActor.id || !this.preferredUsername
|
||||
);
|
||||
},
|
||||
},
|
||||
currentActor: CURRENT_ACTOR_CLIENT,
|
||||
|
||||
@@ -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) =>
|
||||
![
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user