Add front-end for managing group follow

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-10-25 13:18:13 +02:00
parent 244a349b7d
commit f8eda4aac5
12 changed files with 217 additions and 20 deletions

View File

@@ -1,11 +1,17 @@
import {
CURRENT_ACTOR_CLIENT,
GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED,
PERSON_MEMBERSHIP_GROUP,
PERSON_STATUS_GROUP,
} from "@/graphql/actor";
import { FETCH_GROUP } from "@/graphql/group";
import RouteName from "@/router/name";
import { IActor, IGroup, IPerson, usernameWithDomain } from "@/types/actor";
import {
IActor,
IFollower,
IGroup,
IPerson,
usernameWithDomain,
} from "@/types/actor";
import { MemberRole } from "@/types/enums";
import { Component, Vue } from "vue-property-decorator";
@@ -31,7 +37,7 @@ const now = new Date();
},
},
person: {
query: PERSON_MEMBERSHIP_GROUP,
query: PERSON_STATUS_GROUP,
fetchPolicy: "cache-and-network",
variables() {
return {
@@ -100,6 +106,21 @@ export default class GroupMixin extends Vue {
);
}
get isCurrentActorFollowing(): boolean {
return this.currentActorFollow !== null;
}
get isCurrentActorFollowingNotify(): boolean {
return this.currentActorFollow?.notify === true;
}
get currentActorFollow(): IFollower | null {
if (this.person?.follows?.total > 0) {
return this.person?.follows?.elements[0];
}
return null;
}
handleErrors(errors: any[]): void {
if (
errors.some((error) => error.status_code === 404) ||