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">
|
2022-07-12 10:55:28 +02:00
|
|
|
<h2 class="">{{ $t("Details") }}</h2>
|
2022-01-13 15:04:43 +01:00
|
|
|
<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-08-26 16:08:58 +02:00
|
|
|
class="odd:bg-white dark:odd:bg-zinc-800 even:bg-gray-50 dark:even:bg-zinc-700 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-08-26 16:08:58 +02:00
|
|
|
class="py-4 px-2 text-sm text-gray-500 dark:text-gray-200 whitespace-nowrap"
|
2022-01-13 15:04:43 +01:00
|
|
|
>
|
|
|
|
<router-link :to="link">
|
|
|
|
{{ value }}
|
|
|
|
</router-link>
|
|
|
|
</td>
|
|
|
|
<td
|
|
|
|
v-else
|
2022-08-26 16:08:58 +02:00
|
|
|
class="py-4 px-2 text-sm text-gray-500 dark:text-gray-200 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">
|
2022-07-12 10:55:28 +02:00
|
|
|
<h2 class="">{{ $t("Actions") }}</h2>
|
2022-01-13 15:04:43 +01:00
|
|
|
<div class="buttons" v-if="person.domain">
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-button
|
|
|
|
@click="suspendProfile({ id })"
|
2022-01-13 15:04:43 +01:00
|
|
|
v-if="person.domain && !person.suspended"
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="primary"
|
|
|
|
>{{ $t("Suspend") }}</o-button
|
2022-01-13 15:04:43 +01:00
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-button
|
|
|
|
@click="unsuspendProfile({ id })"
|
2022-01-13 15:04:43 +01:00
|
|
|
v-if="person.domain && person.suspended"
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="primary"
|
|
|
|
>{{ $t("Unsuspend") }}</o-button
|
2022-01-13 15:04:43 +01:00
|
|
|
>
|
|
|
|
</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-07-12 10:55:28 +02:00
|
|
|
<i18n-t
|
|
|
|
keypath="This profile is located on this instance, so you need to {access_the_corresponding_account} to suspend it."
|
2022-01-13 15:04:43 +01:00
|
|
|
>
|
|
|
|
<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>
|
2022-07-12 10:55:28 +02:00
|
|
|
</i18n-t>
|
2022-01-13 15:04:43 +01:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section class="mt-4 mb-3">
|
2022-07-12 10:55:28 +02:00
|
|
|
<h2 class="">{{ $t("Organized events") }}</h2>
|
|
|
|
<o-table
|
2022-08-26 16:08:58 +02:00
|
|
|
:data="person.organizedEvents?.elements"
|
2022-07-12 10:55:28 +02:00
|
|
|
:loading="loading"
|
2020-06-11 19:13:21 +02:00
|
|
|
paginated
|
|
|
|
backend-pagination
|
2022-07-12 10:55:28 +02:00
|
|
|
v-model:current-page="organizedEventsPage"
|
2021-05-12 18:10:07 +02:00
|
|
|
:aria-next-label="$t('Next page')"
|
|
|
|
:aria-previous-label="$t('Previous page')"
|
|
|
|
:aria-page-label="$t('Page')"
|
|
|
|
:aria-current-label="$t('Current page')"
|
2022-08-26 16:08:58 +02:00
|
|
|
:total="person.organizedEvents?.total"
|
2020-06-11 19:13:21 +02:00
|
|
|
:per-page="EVENTS_PER_PAGE"
|
|
|
|
@page-change="onOrganizedEventsPageChange"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-table-column
|
2020-11-30 10:24:11 +01:00
|
|
|
field="beginsOn"
|
|
|
|
:label="$t('Begins on')"
|
|
|
|
v-slot="props"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
{{ formatDateTimeString(props.row.beginsOn) }}
|
|
|
|
</o-table-column>
|
|
|
|
<o-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>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table-column>
|
|
|
|
<template #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>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table>
|
2020-06-11 19:13:21 +02:00
|
|
|
</section>
|
2022-01-13 15:04:43 +01:00
|
|
|
<section class="mt-4 mb-3">
|
2022-07-12 10:55:28 +02:00
|
|
|
<h2 class="">{{ $t("Participations") }}</h2>
|
|
|
|
<o-table
|
2020-11-30 10:24:11 +01:00
|
|
|
:data="
|
2022-08-26 16:08:58 +02:00
|
|
|
person.participations?.elements.map(
|
2020-11-30 10:24:11 +01:00
|
|
|
(participation) => participation.event
|
|
|
|
)
|
|
|
|
"
|
2022-07-12 10:55:28 +02:00
|
|
|
:loading="loading"
|
2020-06-11 19:13:21 +02:00
|
|
|
paginated
|
|
|
|
backend-pagination
|
2022-07-12 10:55:28 +02:00
|
|
|
v-model:current-page="participationsPage"
|
2021-05-12 18:10:07 +02:00
|
|
|
:aria-next-label="$t('Next page')"
|
|
|
|
:aria-previous-label="$t('Previous page')"
|
|
|
|
:aria-page-label="$t('Page')"
|
|
|
|
:aria-current-label="$t('Current page')"
|
2022-08-26 16:08:58 +02:00
|
|
|
:total="person.participations?.total"
|
2020-06-11 19:13:21 +02:00
|
|
|
:per-page="EVENTS_PER_PAGE"
|
|
|
|
@page-change="onParticipationsPageChange"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-table-column
|
2020-11-30 10:24:11 +01:00
|
|
|
field="beginsOn"
|
|
|
|
:label="$t('Begins on')"
|
|
|
|
v-slot="props"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
{{ formatDateTimeString(props.row.beginsOn) }}
|
|
|
|
</o-table-column>
|
|
|
|
<o-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>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table-column>
|
|
|
|
<template #empty>
|
2021-05-12 18:10:07 +02:00
|
|
|
<empty-content icon="account-group" :inline="true">
|
|
|
|
{{ $t("No participations listed") }}
|
|
|
|
</empty-content>
|
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table>
|
2021-05-12 18:10:07 +02:00
|
|
|
</section>
|
2022-01-13 15:04:43 +01:00
|
|
|
<section class="mt-4 mb-3">
|
2022-07-12 10:55:28 +02:00
|
|
|
<h2 class="">{{ $t("Memberships") }}</h2>
|
|
|
|
<o-table
|
2022-08-26 16:08:58 +02:00
|
|
|
:data="person.memberships?.elements"
|
2022-07-12 10:55:28 +02:00
|
|
|
:loading="loading"
|
2021-05-12 18:10:07 +02:00
|
|
|
paginated
|
|
|
|
backend-pagination
|
2022-07-12 10:55:28 +02:00
|
|
|
v-model:current-page="membershipsPage"
|
2021-05-12 18:10:07 +02:00
|
|
|
:aria-next-label="$t('Next page')"
|
|
|
|
:aria-previous-label="$t('Previous page')"
|
|
|
|
:aria-page-label="$t('Page')"
|
|
|
|
:aria-current-label="$t('Current page')"
|
2022-08-26 16:08:58 +02:00
|
|
|
:total="person.memberships?.total"
|
2021-05-12 18:10:07 +02:00
|
|
|
:per-page="EVENTS_PER_PAGE"
|
|
|
|
@page-change="onMembershipsPageChange"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-table-column
|
2021-05-12 18:10:07 +02:00
|
|
|
field="parent.preferredUsername"
|
|
|
|
:label="$t('Group')"
|
|
|
|
v-slot="props"
|
|
|
|
>
|
2022-07-12 10:55:28 +02:00
|
|
|
<article class="flex gap-2">
|
|
|
|
<figure class="" v-if="props.row.parent.avatar">
|
2021-05-12 18:10:07 +02:00
|
|
|
<img
|
2022-07-12 10:55:28 +02:00
|
|
|
class="rounded-full"
|
2021-05-12 18:10:07 +02:00
|
|
|
:src="props.row.parent.avatar.url"
|
|
|
|
alt=""
|
2022-07-12 10:55:28 +02:00
|
|
|
width="48"
|
|
|
|
height="48"
|
2021-05-12 18:10:07 +02:00
|
|
|
/>
|
|
|
|
</figure>
|
2022-07-12 10:55:28 +02:00
|
|
|
<AccountCircle v-else :size="48" />
|
|
|
|
<div class="">
|
|
|
|
<div class="prose dark:prose-invert">
|
2021-05-12 18:10:07 +02:00
|
|
|
<span v-if="props.row.parent.name">{{
|
|
|
|
props.row.parent.name
|
|
|
|
}}</span
|
|
|
|
><br />
|
2022-08-26 16:08:58 +02:00
|
|
|
<span>@{{ usernameWithDomain(props.row.parent) }}</span>
|
2021-05-12 18:10:07 +02:00
|
|
|
</div>
|
2020-06-11 19:13:21 +02:00
|
|
|
</div>
|
2021-05-12 18:10:07 +02:00
|
|
|
</article>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table-column>
|
|
|
|
<o-table-column field="role" :label="$t('Role')" v-slot="props">
|
2022-08-26 16:08:58 +02:00
|
|
|
<tag
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="primary"
|
2021-05-12 18:10:07 +02:00
|
|
|
v-if="props.row.role === MemberRole.ADMINISTRATOR"
|
|
|
|
>
|
|
|
|
{{ $t("Administrator") }}
|
2022-08-26 16:08:58 +02:00
|
|
|
</tag>
|
|
|
|
<tag
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="primary"
|
2021-05-12 18:10:07 +02:00
|
|
|
v-else-if="props.row.role === MemberRole.MODERATOR"
|
|
|
|
>
|
|
|
|
{{ $t("Moderator") }}
|
2022-08-26 16:08:58 +02:00
|
|
|
</tag>
|
|
|
|
<tag v-else-if="props.row.role === MemberRole.MEMBER">
|
2021-05-12 18:10:07 +02:00
|
|
|
{{ $t("Member") }}
|
2022-08-26 16:08:58 +02:00
|
|
|
</tag>
|
|
|
|
<tag
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="warning"
|
2021-05-12 18:10:07 +02:00
|
|
|
v-else-if="props.row.role === MemberRole.NOT_APPROVED"
|
|
|
|
>
|
|
|
|
{{ $t("Not approved") }}
|
2022-08-26 16:08:58 +02:00
|
|
|
</tag>
|
|
|
|
<tag
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="danger"
|
2021-05-12 18:10:07 +02:00
|
|
|
v-else-if="props.row.role === MemberRole.REJECTED"
|
|
|
|
>
|
|
|
|
{{ $t("Rejected") }}
|
2022-08-26 16:08:58 +02:00
|
|
|
</tag>
|
|
|
|
<tag
|
2022-07-12 10:55:28 +02:00
|
|
|
variant="danger"
|
2021-05-12 18:10:07 +02:00
|
|
|
v-else-if="props.row.role === MemberRole.INVITED"
|
|
|
|
>
|
|
|
|
{{ $t("Invited") }}
|
2022-08-26 16:08:58 +02:00
|
|
|
</tag>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table-column>
|
|
|
|
<o-table-column field="insertedAt" :label="$t('Date')" v-slot="props">
|
2021-05-12 18:10:07 +02:00
|
|
|
<span class="has-text-centered">
|
2022-07-12 10:55:28 +02:00
|
|
|
{{ formatDateString(props.row.insertedAt) }}<br />{{
|
|
|
|
formatTimeString(props.row.insertedAt)
|
2021-05-12 18:10:07 +02:00
|
|
|
}}
|
|
|
|
</span>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table-column>
|
|
|
|
<template #empty>
|
2021-05-12 18:10:07 +02:00
|
|
|
<empty-content icon="account-group" :inline="true">
|
|
|
|
{{ $t("No memberships found") }}
|
|
|
|
</empty-content>
|
2020-06-11 19:13:21 +02:00
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
</o-table>
|
2020-06-11 19:13:21 +02:00
|
|
|
</section>
|
|
|
|
</div>
|
2022-07-12 10:55:28 +02:00
|
|
|
<empty-content v-else-if="!loading" icon="account">
|
2021-12-13 17:33:10 +01:00
|
|
|
{{ $t("This profile was not found") }}
|
|
|
|
<template #desc>
|
2022-07-12 10:55:28 +02:00
|
|
|
<o-button
|
2022-08-26 16:08:58 +02:00
|
|
|
variant="text"
|
2021-12-13 17:33:10 +01:00
|
|
|
tag="router-link"
|
|
|
|
:to="{ name: RouteName.PROFILES }"
|
2022-07-12 10:55:28 +02:00
|
|
|
>{{ $t("Back to profile list") }}</o-button
|
2021-12-13 17:33:10 +01:00
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</empty-content>
|
2020-06-11 19:13:21 +02:00
|
|
|
</template>
|
2022-07-12 10:55:28 +02:00
|
|
|
<script lang="ts" setup>
|
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,
|
2022-07-12 10:55:28 +02:00
|
|
|
} from "@/graphql/actor";
|
|
|
|
import { IPerson } from "@/types/actor";
|
|
|
|
import { displayName, usernameWithDomain } from "@/types/actor/actor.model";
|
|
|
|
import RouteName from "@/router/name";
|
|
|
|
import ActorCard from "@/components/Account/ActorCard.vue";
|
|
|
|
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 { MemberRole } from "@/types/enums";
|
2021-06-30 18:04:01 +02:00
|
|
|
import cloneDeep from "lodash/cloneDeep";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { useMutation, useQuery } from "@vue/apollo-composable";
|
|
|
|
import { integerTransformer, useRouteQuery } from "vue-use-route-query";
|
|
|
|
import { useHead } from "@vueuse/head";
|
|
|
|
import { computed } from "vue";
|
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
|
import {
|
|
|
|
formatDateString,
|
|
|
|
formatTimeString,
|
|
|
|
formatDateTimeString,
|
|
|
|
} from "@/filters/datetime";
|
|
|
|
import AccountCircle from "vue-material-design-icons/AccountCircle.vue";
|
2022-09-20 16:53:26 +02:00
|
|
|
import Tag from "@/components/TagElement.vue";
|
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
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const props = defineProps<{ id: string }>();
|
2021-05-12 18:10:07 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const organizedEventsPage = useRouteQuery(
|
|
|
|
"organizedEventsPage",
|
|
|
|
1,
|
|
|
|
integerTransformer
|
|
|
|
);
|
|
|
|
const participationsPage = useRouteQuery(
|
|
|
|
"participationsPage",
|
|
|
|
1,
|
|
|
|
integerTransformer
|
|
|
|
);
|
|
|
|
const membershipsPage = useRouteQuery("membershipsPage", 1, integerTransformer);
|
2021-05-12 18:10:07 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const {
|
|
|
|
result: personResult,
|
|
|
|
fetchMore,
|
|
|
|
loading,
|
|
|
|
} = useQuery<{ person: IPerson }>(GET_PERSON, () => ({
|
|
|
|
actorId: props.id,
|
|
|
|
organizedEventsPage: organizedEventsPage.value,
|
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
|
|
|
participationsPage: participationsPage.value,
|
|
|
|
participationLimit: PARTICIPATIONS_PER_PAGE,
|
|
|
|
membershipsPage: membershipsPage.value,
|
|
|
|
membershipsLimit: MEMBERSHIPS_PER_PAGE,
|
|
|
|
}));
|
2021-05-12 18:10:07 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const person = computed(() => personResult.value?.person);
|
2021-05-12 18:10:07 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { t } = useI18n({ useScope: "global" });
|
2021-05-12 18:10:07 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
useHead({
|
|
|
|
title: computed(() => displayName(person.value)),
|
|
|
|
});
|
2020-07-09 17:24:28 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const metadata = computed(
|
|
|
|
(): Array<{
|
|
|
|
key: string;
|
|
|
|
value: string;
|
|
|
|
link?: { name: string; params: Record<string, any> };
|
|
|
|
}> => {
|
|
|
|
if (!person.value) return [];
|
|
|
|
const res: {
|
|
|
|
key: string;
|
|
|
|
value: string;
|
|
|
|
link?: { name: string; params: Record<string, any> };
|
|
|
|
}[] = [
|
2020-06-11 19:13:21 +02:00
|
|
|
{
|
2022-07-12 10:55:28 +02:00
|
|
|
key: t("Status"),
|
|
|
|
value: person.value.suspended ? t("Suspended") : t("Active"),
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
|
|
|
{
|
2022-07-12 10:55:28 +02:00
|
|
|
key: t("Domain"),
|
|
|
|
value: person.value.domain ? person.value.domain : t("Local"),
|
|
|
|
link: person.value.domain
|
2021-12-28 11:42:08 +01:00
|
|
|
? {
|
|
|
|
name: RouteName.INSTANCE,
|
2022-07-12 10:55:28 +02:00
|
|
|
params: { domain: person.value.domain },
|
2021-12-28 11:42:08 +01:00
|
|
|
}
|
|
|
|
: undefined,
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
2020-11-23 16:58:50 +01:00
|
|
|
{
|
2022-07-12 10:55:28 +02:00
|
|
|
key: t("Uploaded media size"),
|
|
|
|
value: formatBytes(person.value.mediaSize ?? 0),
|
2020-11-23 16:58:50 +01:00
|
|
|
},
|
2020-06-11 19:13:21 +02:00
|
|
|
];
|
2022-07-12 10:55:28 +02:00
|
|
|
if (!person.value.domain && person.value.user) {
|
2020-06-11 19:13:21 +02:00
|
|
|
res.push({
|
2022-07-12 10:55:28 +02:00
|
|
|
key: t("User"),
|
2020-11-30 10:24:11 +01:00
|
|
|
link: {
|
|
|
|
name: RouteName.ADMIN_USER_PROFILE,
|
2022-07-12 10:55:28 +02:00
|
|
|
params: { id: person.value.user.id },
|
2020-11-30 10:24:11 +01:00
|
|
|
},
|
2022-07-12 10:55:28 +02:00
|
|
|
value: person.value.user.email,
|
2020-06-11 19:13:21 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
2022-07-12 10:55:28 +02:00
|
|
|
);
|
2020-06-11 19:13:21 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { mutate: suspendProfile } = useMutation<
|
|
|
|
{
|
|
|
|
suspendProfile: { id: string };
|
|
|
|
},
|
|
|
|
{ id: string }
|
|
|
|
>(SUSPEND_PROFILE, () => ({
|
|
|
|
update: (
|
|
|
|
store: ApolloCache<{ suspendProfile: { id: string } }>,
|
|
|
|
{ data }: FetchResult
|
|
|
|
) => {
|
|
|
|
if (data == null) return;
|
|
|
|
const profileId = props.id;
|
2020-06-11 19:13:21 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const profileData = store.readQuery<{ person: IPerson }>({
|
|
|
|
query: GET_PERSON,
|
|
|
|
variables: {
|
|
|
|
actorId: profileId,
|
|
|
|
organizedEventsPage: 1,
|
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
|
|
|
participationsPage: 1,
|
|
|
|
participationLimit: PARTICIPATIONS_PER_PAGE,
|
|
|
|
membershipsPage: 1,
|
|
|
|
membershipsLimit: MEMBERSHIPS_PER_PAGE,
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
if (!profileData) return;
|
2022-08-26 16:08:58 +02:00
|
|
|
const { person: cachedPerson } = profileData;
|
2022-07-12 10:55:28 +02:00
|
|
|
store.writeQuery({
|
|
|
|
query: GET_PERSON,
|
2020-06-11 19:13:21 +02:00
|
|
|
variables: {
|
2022-07-12 10:55:28 +02:00
|
|
|
actorId: profileId,
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
2022-07-12 10:55:28 +02:00
|
|
|
data: {
|
|
|
|
person: {
|
2022-08-26 16:08:58 +02:00
|
|
|
...cloneDeep(cachedPerson),
|
2022-07-12 10:55:28 +02:00
|
|
|
participations: { total: 0, elements: [] },
|
|
|
|
suspended: true,
|
|
|
|
avatar: null,
|
|
|
|
name: "",
|
|
|
|
summary: "",
|
2020-06-11 19:13:21 +02:00
|
|
|
},
|
2022-07-12 10:55:28 +02:00
|
|
|
},
|
2020-06-11 19:13:21 +02:00
|
|
|
});
|
2022-07-12 10:55:28 +02:00
|
|
|
},
|
|
|
|
}));
|
2020-06-11 19:13:21 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const { mutate: unsuspendProfile } = useMutation<
|
|
|
|
{ unsuspendProfile: { id: string } },
|
|
|
|
{ id: string }
|
|
|
|
>(UNSUSPEND_PROFILE, () => ({
|
|
|
|
refetchQueries: [
|
|
|
|
{
|
|
|
|
query: GET_PERSON,
|
2020-06-11 19:13:21 +02:00
|
|
|
variables: {
|
2022-07-12 10:55:28 +02:00
|
|
|
actorId: props.id,
|
|
|
|
organizedEventsPage: 1,
|
2020-06-11 19:13:21 +02:00
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
|
|
|
},
|
2022-07-12 10:55:28 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}));
|
2020-06-11 19:13:21 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const onOrganizedEventsPageChange = async (): Promise<void> => {
|
|
|
|
await fetchMore({
|
|
|
|
variables: {
|
|
|
|
actorId: props.id,
|
|
|
|
organizedEventsPage: organizedEventsPage.value,
|
|
|
|
organizedEventsLimit: EVENTS_PER_PAGE,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
2021-05-12 18:10:07 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const onParticipationsPageChange = async (): Promise<void> => {
|
|
|
|
await fetchMore({
|
|
|
|
variables: {
|
|
|
|
actorId: props.id,
|
|
|
|
participationPage: participationsPage.value,
|
|
|
|
participationLimit: PARTICIPATIONS_PER_PAGE,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
2021-05-12 18:10:07 +02:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const onMembershipsPageChange = async (): Promise<void> => {
|
|
|
|
await fetchMore({
|
|
|
|
variables: {
|
|
|
|
actorId: props.id,
|
|
|
|
membershipsPage: participationsPage.value,
|
|
|
|
membershipsLimit: MEMBERSHIPS_PER_PAGE,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
2020-06-11 19:13:21 +02:00
|
|
|
</script>
|