2020-06-11 19:13:21 +02:00
|
|
|
<template>
|
|
|
|
<div v-if="person" class="section">
|
2022-01-10 15:19:16 +01:00
|
|
|
<breadcrumbs-nav
|
|
|
|
:links="[
|
|
|
|
{ name: RouteName.ADMIN, text: $t('Admin') },
|
|
|
|
{
|
|
|
|
name: RouteName.PROFILES,
|
|
|
|
text: $t('Profiles'),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: RouteName.PROFILES,
|
|
|
|
params: { id: person.id },
|
|
|
|
text: displayName(person),
|
|
|
|
},
|
|
|
|
]"
|
|
|
|
/>
|
|
|
|
|
2022-01-14 18:10:50 +01:00
|
|
|
<div class="flex justify-center">
|
|
|
|
<actor-card
|
|
|
|
:actor="person"
|
|
|
|
:full="true"
|
|
|
|
:popover="false"
|
|
|
|
:limit="false"
|
|
|
|
/>
|
|
|
|
</div>
|
2022-01-13 15:04:43 +01:00
|
|
|
<section class="mt-4 mb-3">
|
|
|
|
<h2 class="text-lg font-bold">{{ $t("Details") }}</h2>
|
|
|
|
<div class="flex flex-col">
|
|
|
|
<div class="overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
|
|
<div class="inline-block py-2 min-w-full sm:px-2 lg:px-8">
|
|
|
|
<div class="overflow-hidden shadow-md sm:rounded-lg">
|
|
|
|
<table v-if="metadata.length > 0" class="min-w-full">
|
|
|
|
<tbody>
|
|
|
|
<tr
|
|
|
|
v-for="{ key, value, link } in metadata"
|
|
|
|
:key="key"
|
2022-01-14 18:10:50 +01:00
|
|
|
class="odd:bg-white even:bg-gray-50 border-b"
|
2022-01-13 15:04:43 +01:00
|
|
|
>
|
2022-01-14 18:10:50 +01:00
|
|
|
<td class="py-4 px-2 whitespace-nowrap">
|
2022-01-13 15:04:43 +01:00
|
|
|
{{ key }}
|
|
|
|
</td>
|
|
|
|
<td
|
|
|
|
v-if="link"
|
2022-01-14 18:10:50 +01:00
|
|
|
class="py-4 px-2 text-sm text-gray-500 whitespace-nowrap"
|
2022-01-13 15:04:43 +01:00
|
|
|
>
|
|
|
|
<router-link :to="link">
|
|
|
|
{{ value }}
|
|
|
|
</router-link>
|
|
|
|
</td>
|
|
|
|
<td
|
|
|
|
v-else
|
2022-01-14 18:10:50 +01:00
|
|
|
class="py-4 px-2 text-sm text-gray-500 whitespace-nowrap"
|
2022-01-13 15:04:43 +01:00
|
|
|
>
|
|
|
|
{{ value }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section class="mt-4 mb-3">
|
|
|
|
<h2 class="text-lg font-bold">{{ $t("Actions") }}</h2>
|
|
|
|
<div class="buttons" v-if="person.domain">
|
|
|
|
<b-button
|
|
|
|
@click="suspendProfile"
|
|
|
|
v-if="person.domain && !person.suspended"
|
|
|
|
type="is-primary"
|
|
|
|
>{{ $t("Suspend") }}</b-button
|
|
|
|
>
|
|
|
|
<b-button
|
|
|
|
@click="unsuspendProfile"
|
|
|
|
v-if="person.domain && person.suspended"
|
|
|
|
type="is-primary"
|
|
|
|
>{{ $t("Unsuspend") }}</b-button
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
<p v-else></p>
|
|
|
|
<div
|
2022-01-14 18:10:50 +01:00
|
|
|
v-if="person.user"
|
|
|
|
class="p-4 mb-4 text-sm text-blue-700 bg-blue-100 rounded-lg"
|
2022-01-13 15:04:43 +01:00
|
|
|
role="alert"
|
2020-06-11 19:13:21 +02:00
|
|
|
>
|
2022-01-13 15:04:43 +01:00
|
|
|
<i18n
|
|
|
|
path="This profile is located on this instance, so you need to {access_the_corresponding_account} to suspend it."
|
|
|
|
>
|
|
|
|
<template #access_the_corresponding_account>
|
|
|
|
<router-link
|
|
|
|
class="underline"
|
|
|
|
:to="{
|
|
|
|
name: RouteName.ADMIN_USER_PROFILE,
|
|
|
|
params: { id: person.user.id },
|
|
|
|
}"
|
|
|
|
>{{ $t("access the corresponding account") }}</router-link
|
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</i18n>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section class="mt-4 mb-3">
|
|
|
|
<h2 class="text-lg font-bold">{{ $t("Organized events") }}</h2>
|
2020-06-11 19:13:21 +02:00
|
|
|
<b-table
|
|
|
|
:data="person.organizedEvents.elements"
|
|
|
|
:loading="$apollo.queries.person.loading"
|
|
|
|
paginated
|
|
|
|
backend-pagination
|
2021-05-12 18:10:07 +02:00
|
|
|
:current-page.sync="organizedEventsPage"
|
|
|
|
:aria-next-label="$t('Next page')"
|
|
|
|
:aria-previous-label="$t('Previous page')"
|
|
|
|
:aria-page-label="$t('Page')"
|
|
|
|
:aria-current-label="$t('Current page')"
|
2020-06-11 19:13:21 +02:00
|
|
|
:total="person.organizedEvents.total"
|
|
|
|
:per-page="EVENTS_PER_PAGE"
|
|
|
|
@page-change="onOrganizedEventsPageChange"
|
|
|
|
>
|
2020-11-30 10:24:11 +01:00
|
|
|
<b-table-column
|
|
|
|
field="beginsOn"
|
|
|
|
:label="$t('Begins on')"
|
|
|
|
v-slot="props"
|
|
|
|
>
|
2020-08-18 15:50:50 +02:00
|
|
|
{{ props.row.beginsOn | formatDateTimeString }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="title" :label="$t('Title')" v-slot="props">
|
2020-11-30 10:24:11 +01:00
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.EVENT, params: { uuid: props.row.uuid } }"
|
|
|
|
>
|
2020-08-18 15:50:50 +02:00
|
|
|
{{ props.row.title }}
|
|
|
|
</router-link>
|
|
|
|
</b-table-column>
|
2020-06-11 19:13:21 +02:00
|
|
|
<template slot="empty">
|
2021-05-12 18:10:07 +02:00
|
|
|
<empty-content icon="account-group" :inline="true">
|
|
|
|
{{ $t("No organized events listed") }}
|
|
|
|
</empty-content>
|
2020-06-11 19:13:21 +02:00
|
|
|
</template>
|
|
|
|
</b-table>
|
|
|
|
</section>
|
2022-01-13 15:04:43 +01:00
|
|
|
<section class="mt-4 mb-3">
|
|
|
|
<h2 class="text-lg font-bold">{{ $t("Participations") }}</h2>
|
2020-06-11 19:13:21 +02:00
|
|
|
<b-table
|
2020-11-30 10:24:11 +01:00
|
|
|
:data="
|
|
|
|
person.participations.elements.map(
|
|
|
|
(participation) => participation.event
|
|
|
|
)
|
|
|
|
"
|
2021-05-12 18:10:07 +02:00
|
|
|
:loading="$apollo.loading"
|
2020-06-11 19:13:21 +02:00
|
|
|
paginated
|
|
|
|
backend-pagination
|
2021-05-12 18:10:07 +02:00
|
|
|
:current-page.sync="participationsPage"
|
|
|
|
:aria-next-label="$t('Next page')"
|
|
|
|
:aria-previous-label="$t('Previous page')"
|
|
|
|
:aria-page-label="$t('Page')"
|
|
|
|
:aria-current-label="$t('Current page')"
|
2020-06-11 19:13:21 +02:00
|
|
|
:total="person.participations.total"
|
|
|
|
:per-page="EVENTS_PER_PAGE"
|
|
|
|
@page-change="onParticipationsPageChange"
|
|
|
|
>
|
2020-11-30 10:24:11 +01:00
|
|
|
<b-table-column
|
|
|
|
field="beginsOn"
|
|
|
|
:label="$t('Begins on')"
|
|
|
|
v-slot="props"
|
|
|
|
>
|
2020-08-18 15:50:50 +02:00
|
|
|
{{ props.row.beginsOn | formatDateTimeString }}
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="title" :label="$t('Title')" v-slot="props">
|
2020-11-30 10:24:11 +01:00
|
|
|
<router-link
|
|
|
|
:to="{ name: RouteName.EVENT, params: { uuid: props.row.uuid } }"
|
|
|
|
>
|
2020-08-18 15:50:50 +02:00
|
|
|
{{ props.row.title }}
|
|
|
|
</router-link>
|
|
|
|
</b-table-column>
|
2020-06-11 19:13:21 +02:00
|
|
|
<template slot="empty">
|
2021-05-12 18:10:07 +02:00
|
|
|
<empty-content icon="account-group" :inline="true">
|
|
|
|
{{ $t("No participations listed") }}
|
|
|
|
</empty-content>
|
|
|
|
</template>
|
|
|
|
</b-table>
|
|
|
|
</section>
|
2022-01-13 15:04:43 +01:00
|
|
|
<section class="mt-4 mb-3">
|
|
|
|
<h2 class="text-lg font-bold">{{ $t("Memberships") }}</h2>
|
2021-05-12 18:10:07 +02:00
|
|
|
<b-table
|
|
|
|
:data="person.memberships.elements"
|
|
|
|
:loading="$apollo.loading"
|
|
|
|
paginated
|
|
|
|
backend-pagination
|
|
|
|
:current-page.sync="membershipsPage"
|
|
|
|
:aria-next-label="$t('Next page')"
|
|
|
|
:aria-previous-label="$t('Previous page')"
|
|
|
|
:aria-page-label="$t('Page')"
|
|
|
|
:aria-current-label="$t('Current page')"
|
|
|
|
:total="person.memberships.total"
|
|
|
|
:per-page="EVENTS_PER_PAGE"
|
|
|
|
@page-change="onMembershipsPageChange"
|
|
|
|
>
|
|
|
|
<b-table-column
|
|
|
|
field="parent.preferredUsername"
|
|
|
|
:label="$t('Group')"
|
|
|
|
v-slot="props"
|
|
|
|
>
|
|
|
|
<article class="media">
|
|
|
|
<figure
|
|
|
|
class="media-left image is-48x48"
|
|
|
|
v-if="props.row.parent.avatar"
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
class="is-rounded"
|
|
|
|
:src="props.row.parent.avatar.url"
|
|
|
|
alt=""
|
|
|
|
/>
|
|
|
|
</figure>
|
|
|
|
<b-icon
|
|
|
|
class="media-left"
|
|
|
|
v-else
|
|
|
|
size="is-large"
|
|
|
|
icon="account-circle"
|
|
|
|
/>
|
|
|
|
<div class="media-content">
|
|
|
|
<div class="content">
|
|
|
|
<span v-if="props.row.parent.name">{{
|
|
|
|
props.row.parent.name
|
|
|
|
}}</span
|
|
|
|
><br />
|
|
|
|
<span class="is-size-7 has-text-grey"
|
|
|
|
>@{{ usernameWithDomain(props.row.parent) }}</span
|
|
|
|
>
|
|
|
|
</div>
|
2020-06-11 19:13:21 +02:00
|
|
|
</div>
|
2021-05-12 18:10:07 +02:00
|
|
|
</article>
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="role" :label="$t('Role')" v-slot="props">
|
|
|
|
<b-tag
|
|
|
|
type="is-primary"
|
|
|
|
v-if="props.row.role === MemberRole.ADMINISTRATOR"
|
|
|
|
>
|
|
|
|
{{ $t("Administrator") }}
|
|
|
|
</b-tag>
|
|
|
|
<b-tag
|
|
|
|
type="is-primary"
|
|
|
|
v-else-if="props.row.role === MemberRole.MODERATOR"
|
|
|
|
>
|
|
|
|
{{ $t("Moderator") }}
|
|
|
|
</b-tag>
|
|
|
|
<b-tag v-else-if="props.row.role === MemberRole.MEMBER">
|
|
|
|
{{ $t("Member") }}
|
|
|
|
</b-tag>
|
|
|
|
<b-tag
|
|
|
|
type="is-warning"
|
|
|
|
v-else-if="props.row.role === MemberRole.NOT_APPROVED"
|
|
|
|
>
|
|
|
|
{{ $t("Not approved") }}
|
|
|
|
</b-tag>
|
|
|
|
<b-tag
|
|
|
|
type="is-danger"
|
|
|
|
v-else-if="props.row.role === MemberRole.REJECTED"
|
|
|
|
>
|
|
|
|
{{ $t("Rejected") }}
|
|
|
|
</b-tag>
|
|
|
|
<b-tag
|
|
|
|
type="is-danger"
|
|
|
|
v-else-if="props.row.role === MemberRole.INVITED"
|
|
|
|
>
|
|
|
|
{{ $t("Invited") }}
|
|
|
|
</b-tag>
|
|
|
|
</b-table-column>
|
|
|
|
<b-table-column field="insertedAt" :label="$t('Date')" v-slot="props">
|
|
|
|
<span class="has-text-centered">
|
|
|
|
{{ props.row.insertedAt | formatDateString }}<br />{{
|
|
|
|
props.row.insertedAt | formatTimeString
|
|
|
|
}}
|
|
|
|
</span>
|
|
|
|
</b-table-column>
|
|
|
|
<template slot="empty">
|
|
|
|
<empty-content icon="account-group" :inline="true">
|
|
|
|
{{ $t("No memberships found") }}
|
|
|
|
</empty-content>
|
2020-06-11 19:13:21 +02:00
|
|
|
</template>
|
|
|
|
</b-table>
|
|
|
|
</section>
|
|
|
|
</div>
|
2021-12-13 17:33:10 +01:00
|
|
|
<empty-content v-else-if="!$apollo.loading" icon="account">
|
|
|
|
{{ $t("This profile was not found") }}
|
|
|
|
<template #desc>
|
|
|
|
<b-button
|
|
|
|
type="is-text"
|
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.PROFILES }"
|
|
|
|
>{{ $t("Back to profile list") }}</b-button
|
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</empty-content>
|
2020-06-11 19:13:21 +02:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Vue, Prop } from "vue-property-decorator";
|
2020-11-23 16:58:50 +01:00
|
|
|
import { formatBytes } from "@/utils/datetime";
|
2020-11-30 10:24:11 +01:00
|
|
|
import {
|
|
|
|
GET_PERSON,
|
|
|
|
SUSPEND_PROFILE,
|
|
|
|
UNSUSPEND_PROFILE,
|
|
|
|
} from "../../graphql/actor";
|
2020-06-11 19:13:21 +02:00
|
|
|
import { IPerson } from "../../types/actor";
|
2022-01-10 15:19:16 +01:00
|
|
|
import { displayName, usernameWithDomain } from "../../types/actor/actor.model";
|
2020-06-11 19:13:21 +02:00
|
|
|
import RouteName from "../../router/name";
|
2020-06-16 12:03:09 +02:00
|
|
|
import ActorCard from "../../components/Account/ActorCard.vue";
|
2021-05-12 18:10:07 +02:00
|
|
|
import EmptyContent from "../../components/Utils/EmptyContent.vue";
|
2021-06-11 14:21:27 +02:00
|
|
|
import { ApolloCache, FetchResult } from "@apollo/client/core";
|
2021-05-12 18:10:07 +02:00
|
|
|
import VueRouter from "vue-router";
|
|
|
|
import { MemberRole } from "@/types/enums";
|
2021-06-30 18:04:01 +02:00
|
|
|
import cloneDeep from "lodash/cloneDeep";
|
2021-05-12 18:10:07 +02:00
|
|
|
const { isNavigationFailure, NavigationFailureType } = VueRouter;
|
2020-06-11 19:13:21 +02:00
|
|
|
|
|
|
|
const EVENTS_PER_PAGE = 10;
|
2021-05-12 18:10:07 +02:00
|
|
|
const PARTICIPATIONS_PER_PAGE = 10;
|
|
|
|
const MEMBERSHIPS_PER_PAGE = 10;
|
2020-06-11 19:13:21 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
apollo: {
|
|
|
|
person: {
|
|
|
|
query: GET_PERSON,
|
2020-08-27 11:53:24 +02:00
|
|
|
fetchPolicy: "cache-and-network",
|
2020-06-11 19:13:21 +02:00
|
|
|
variables() {
|
|
|
|
return {
|
|
|
|
actorId: this.id,
|
2021-05-12 18:10:07 +02:00
|
|
|
organizedEventsPage: this.organizedEventsPage,
|
2020-06-11 19:13:21 +02:00
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
2021-05-12 18:10:07 +02:00
|
|
|
participationsPage: this.participationsPage,
|
|
|
|
participationLimit: PARTICIPATIONS_PER_PAGE,
|
|
|
|
membershipsPage: this.membershipsPage,
|
|
|
|
membershipsLimit: MEMBERSHIPS_PER_PAGE,
|
2020-06-11 19:13:21 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
skip() {
|
|
|
|
return !this.id;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2020-06-16 12:03:09 +02:00
|
|
|
components: {
|
|
|
|
ActorCard,
|
2021-05-12 18:10:07 +02:00
|
|
|
EmptyContent,
|
2020-06-16 12:03:09 +02:00
|
|
|
},
|
2021-10-10 16:24:12 +02:00
|
|
|
metaInfo() {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
// @ts-ignore
|
|
|
|
const { person } = this;
|
|
|
|
return {
|
|
|
|
title: person ? person.name || usernameWithDomain(person) : "",
|
|
|
|
};
|
|
|
|
},
|
2020-06-11 19:13:21 +02:00
|
|
|
})
|
|
|
|
export default class AdminProfile extends Vue {
|
2020-07-09 17:24:28 +02:00
|
|
|
@Prop({ required: true }) id!: string;
|
2020-06-11 19:13:21 +02:00
|
|
|
|
|
|
|
person!: IPerson;
|
|
|
|
|
|
|
|
usernameWithDomain = usernameWithDomain;
|
|
|
|
|
2022-01-10 15:19:16 +01:00
|
|
|
displayName = displayName;
|
|
|
|
|
2020-06-11 19:13:21 +02:00
|
|
|
RouteName = RouteName;
|
|
|
|
|
|
|
|
EVENTS_PER_PAGE = EVENTS_PER_PAGE;
|
|
|
|
|
2021-05-12 18:10:07 +02:00
|
|
|
PARTICIPATIONS_PER_PAGE = PARTICIPATIONS_PER_PAGE;
|
|
|
|
|
|
|
|
MEMBERSHIPS_PER_PAGE = MEMBERSHIPS_PER_PAGE;
|
|
|
|
|
|
|
|
MemberRole = MemberRole;
|
|
|
|
|
|
|
|
get organizedEventsPage(): number {
|
|
|
|
return parseInt(
|
|
|
|
(this.$route.query.organizedEventsPage as string) || "1",
|
|
|
|
10
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
set organizedEventsPage(page: number) {
|
|
|
|
this.pushRouter({ organizedEventsPage: page.toString() });
|
|
|
|
}
|
|
|
|
|
|
|
|
get participationsPage(): number {
|
|
|
|
return parseInt(
|
|
|
|
(this.$route.query.participationsPage as string) || "1",
|
|
|
|
10
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
set participationsPage(page: number) {
|
|
|
|
this.pushRouter({ participationsPage: page.toString() });
|
|
|
|
}
|
|
|
|
|
|
|
|
get membershipsPage(): number {
|
|
|
|
return parseInt((this.$route.query.membershipsPage as string) || "1", 10);
|
|
|
|
}
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2021-05-12 18:10:07 +02:00
|
|
|
set membershipsPage(page: number) {
|
|
|
|
this.pushRouter({ membershipsPage: page.toString() });
|
|
|
|
}
|
2020-06-11 19:13:21 +02:00
|
|
|
|
2020-11-23 16:58:50 +01:00
|
|
|
get metadata(): Array<Record<string, unknown>> {
|
2020-06-11 19:13:21 +02:00
|
|
|
if (!this.person) return [];
|
2020-11-23 16:58:50 +01:00
|
|
|
const res: Record<string, unknown>[] = [
|
2020-06-11 19:13:21 +02:00
|
|
|
{
|
|
|
|
key: this.$t("Status") as string,
|
|
|
|
value: this.person.suspended ? this.$t("Suspended") : this.$t("Active"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: this.$t("Domain") as string,
|
|
|
|
value: this.person.domain ? this.person.domain : this.$t("Local"),
|
2021-12-28 11:42:08 +01:00
|
|
|
link: this.person.domain
|
|
|
|
? {
|
|
|
|
name: RouteName.INSTANCE,
|
|
|
|
params: { domain: this.person.domain },
|
|
|
|
}
|
|
|
|
: undefined,
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
2020-11-23 16:58:50 +01:00
|
|
|
{
|
|
|
|
key: this.$i18n.t("Uploaded media size"),
|
|
|
|
value: formatBytes(this.person.mediaSize),
|
|
|
|
},
|
2020-06-11 19:13:21 +02:00
|
|
|
];
|
|
|
|
if (!this.person.domain && this.person.user) {
|
|
|
|
res.push({
|
|
|
|
key: this.$t("User") as string,
|
2020-11-30 10:24:11 +01:00
|
|
|
link: {
|
|
|
|
name: RouteName.ADMIN_USER_PROFILE,
|
|
|
|
params: { id: this.person.user.id },
|
|
|
|
},
|
2020-06-11 19:13:21 +02:00
|
|
|
value: this.person.user.email,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2020-11-23 16:58:50 +01:00
|
|
|
async suspendProfile(): Promise<void> {
|
2020-06-11 19:13:21 +02:00
|
|
|
this.$apollo.mutate<{ suspendProfile: { id: string } }>({
|
|
|
|
mutation: SUSPEND_PROFILE,
|
|
|
|
variables: {
|
|
|
|
id: this.id,
|
|
|
|
},
|
2021-06-11 14:21:27 +02:00
|
|
|
update: (
|
|
|
|
store: ApolloCache<{ suspendProfile: { id: string } }>,
|
|
|
|
{ data }: FetchResult
|
|
|
|
) => {
|
2020-06-11 19:13:21 +02:00
|
|
|
if (data == null) return;
|
|
|
|
const profileId = this.id;
|
|
|
|
|
|
|
|
const profileData = store.readQuery<{ person: IPerson }>({
|
|
|
|
query: GET_PERSON,
|
|
|
|
variables: {
|
|
|
|
actorId: profileId,
|
|
|
|
organizedEventsPage: 1,
|
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
2021-06-30 18:04:01 +02:00
|
|
|
participationsPage: 1,
|
|
|
|
participationLimit: PARTICIPATIONS_PER_PAGE,
|
|
|
|
membershipsPage: 1,
|
|
|
|
membershipsLimit: MEMBERSHIPS_PER_PAGE,
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!profileData) return;
|
|
|
|
const { person } = profileData;
|
|
|
|
store.writeQuery({
|
|
|
|
query: GET_PERSON,
|
|
|
|
variables: {
|
|
|
|
actorId: profileId,
|
|
|
|
},
|
2021-05-12 18:10:07 +02:00
|
|
|
data: {
|
|
|
|
person: {
|
2021-06-30 18:04:01 +02:00
|
|
|
...cloneDeep(person),
|
|
|
|
participations: { total: 0, elements: [] },
|
2021-05-12 18:10:07 +02:00
|
|
|
suspended: true,
|
|
|
|
avatar: null,
|
|
|
|
name: "",
|
|
|
|
summary: "",
|
|
|
|
},
|
|
|
|
},
|
2020-06-11 19:13:21 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-23 16:58:50 +01:00
|
|
|
async unsuspendProfile(): Promise<void> {
|
2020-06-11 19:13:21 +02:00
|
|
|
const profileID = this.id;
|
|
|
|
this.$apollo.mutate<{ unsuspendProfile: { id: string } }>({
|
|
|
|
mutation: UNSUSPEND_PROFILE,
|
|
|
|
variables: {
|
|
|
|
id: this.id,
|
|
|
|
},
|
|
|
|
refetchQueries: [
|
|
|
|
{
|
|
|
|
query: GET_PERSON,
|
|
|
|
variables: {
|
|
|
|
actorId: profileID,
|
|
|
|
organizedEventsPage: 1,
|
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-05-12 18:10:07 +02:00
|
|
|
async onOrganizedEventsPageChange(): Promise<void> {
|
2020-06-11 19:13:21 +02:00
|
|
|
await this.$apollo.queries.person.fetchMore({
|
|
|
|
variables: {
|
|
|
|
actorId: this.id,
|
|
|
|
organizedEventsPage: this.organizedEventsPage,
|
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-05-12 18:10:07 +02:00
|
|
|
async onParticipationsPageChange(): Promise<void> {
|
2020-06-11 19:13:21 +02:00
|
|
|
await this.$apollo.queries.person.fetchMore({
|
|
|
|
variables: {
|
|
|
|
actorId: this.id,
|
|
|
|
participationPage: this.participationsPage,
|
2021-05-12 18:10:07 +02:00
|
|
|
participationLimit: PARTICIPATIONS_PER_PAGE,
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
2021-05-12 18:10:07 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async onMembershipsPageChange(): Promise<void> {
|
|
|
|
await this.$apollo.queries.person.fetchMore({
|
|
|
|
variables: {
|
|
|
|
actorId: this.id,
|
|
|
|
membershipsPage: this.participationsPage,
|
|
|
|
membershipsLimit: MEMBERSHIPS_PER_PAGE,
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
2021-05-12 18:10:07 +02:00
|
|
|
|
|
|
|
private async pushRouter(args: Record<string, string>): Promise<void> {
|
|
|
|
try {
|
|
|
|
await this.$router.push({
|
|
|
|
name: RouteName.ADMIN_PROFILE,
|
|
|
|
query: { ...this.$route.query, ...args },
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
if (isNavigationFailure(e, NavigationFailureType.redirected)) {
|
|
|
|
throw Error(e.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-06-11 19:13:21 +02:00
|
|
|
}
|
|
|
|
</script>
|