2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader /></template>
|
|
|
|
<MkSpacer :content-max="800">
|
|
|
|
<MkPagination ref="paginationComponent" :pagination="pagination">
|
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
|
|
|
<img
|
|
|
|
src="/static-assets/badges/info.png"
|
2023-05-20 07:52:14 +02:00
|
|
|
aria-label="none"
|
2023-04-08 02:01:42 +02:00
|
|
|
class="_ghost"
|
|
|
|
/>
|
|
|
|
<div>{{ i18n.ts.noFollowRequests }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #default="{ items }">
|
2023-05-20 07:52:14 +02:00
|
|
|
<MkInfo
|
|
|
|
v-if="$i?.isLocked === false"
|
|
|
|
warn
|
|
|
|
class="info"
|
|
|
|
>{{ i18n.ts.silencedWarning }}
|
|
|
|
</MkInfo>
|
2023-04-08 02:01:42 +02:00
|
|
|
<div class="mk-follow-requests">
|
|
|
|
<div
|
|
|
|
v-for="req in items"
|
|
|
|
:key="req.id"
|
|
|
|
class="user _panel"
|
|
|
|
>
|
|
|
|
<MkAvatar
|
|
|
|
class="avatar"
|
|
|
|
:user="req.follower"
|
|
|
|
:show-indicator="true"
|
2023-04-29 03:39:48 +02:00
|
|
|
disableLink
|
2023-04-08 02:01:42 +02:00
|
|
|
/>
|
|
|
|
<div class="body">
|
|
|
|
<div class="name">
|
|
|
|
<MkA
|
|
|
|
v-user-preview="req.follower.id"
|
|
|
|
class="name"
|
|
|
|
:to="userPage(req.follower)"
|
|
|
|
><MkUserName :user="req.follower"
|
|
|
|
/></MkA>
|
|
|
|
<p class="acct">
|
|
|
|
@{{ acct(req.follower) }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-if="req.follower.description"
|
|
|
|
class="description"
|
|
|
|
:title="req.follower.description"
|
|
|
|
>
|
|
|
|
<Mfm
|
|
|
|
:text="req.follower.description"
|
|
|
|
:is-note="false"
|
|
|
|
:author="req.follower"
|
|
|
|
:i="$i"
|
|
|
|
:custom-emojis="req.follower.emojis"
|
|
|
|
:plain="true"
|
|
|
|
:nowrap="true"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
|
|
|
<button
|
|
|
|
class="_button"
|
|
|
|
@click="accept(req.follower)"
|
|
|
|
>
|
|
|
|
<i class="ph-check ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
class="_button"
|
|
|
|
@click="reject(req.follower)"
|
|
|
|
>
|
|
|
|
<i class="ph-x ph-bold ph-lg"></i>
|
|
|
|
</button>
|
|
|
|
</div>
|
2022-07-19 07:14:03 +02:00
|
|
|
</div>
|
2022-01-12 18:21:43 +01:00
|
|
|
</div>
|
2020-02-15 00:42:21 +01:00
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
</template>
|
|
|
|
</MkPagination>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-12 18:21:43 +01:00
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import { ref, computed } from "vue";
|
|
|
|
import MkPagination from "@/components/MkPagination.vue";
|
|
|
|
import { userPage, acct } from "@/filters/user";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
2023-05-20 07:52:14 +02:00
|
|
|
import { $i } from "@/account";
|
2022-01-12 18:21:43 +01:00
|
|
|
|
|
|
|
const paginationComponent = ref<InstanceType<typeof MkPagination>>();
|
|
|
|
|
|
|
|
const pagination = {
|
2023-04-08 02:01:42 +02:00
|
|
|
endpoint: "following/requests/list" as const,
|
2022-01-12 18:21:43 +01:00
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-01-12 18:21:43 +01:00
|
|
|
function accept(user) {
|
2023-04-08 02:01:42 +02:00
|
|
|
os.api("following/requests/accept", { userId: user.id }).then(() => {
|
2022-01-12 18:21:43 +01:00
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-01-12 18:21:43 +01:00
|
|
|
function reject(user) {
|
2023-04-08 02:01:42 +02:00
|
|
|
os.api("following/requests/reject", { userId: user.id }).then(() => {
|
2022-01-12 18:21:43 +01:00
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
definePageMetadata(
|
|
|
|
computed(() => ({
|
|
|
|
title: i18n.ts.followRequests,
|
|
|
|
icon: "ph-hand-waving ph-bold ph-lg",
|
|
|
|
}))
|
|
|
|
);
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.mk-follow-requests {
|
|
|
|
> .user {
|
|
|
|
display: flex;
|
|
|
|
padding: 16px;
|
2023-01-16 20:44:28 +01:00
|
|
|
margin: 10px 0 auto;
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
display: block;
|
|
|
|
flex-shrink: 0;
|
|
|
|
margin: 0 12px 0 0;
|
|
|
|
width: 42px;
|
|
|
|
height: 42px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
|
|
|
display: flex;
|
|
|
|
width: calc(100% - 54px);
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
width: 45%;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .name,
|
|
|
|
> .acct {
|
|
|
|
display: block;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
2021-03-02 14:57:16 +01:00
|
|
|
overflow: hidden;
|
2020-01-29 20:37:25 +01:00
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .acct {
|
|
|
|
font-size: 15px;
|
|
|
|
line-height: 16px;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
width: 55%;
|
|
|
|
line-height: 42px;
|
|
|
|
white-space: nowrap;
|
2021-03-02 14:57:16 +01:00
|
|
|
overflow: hidden;
|
2020-01-29 20:37:25 +01:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
opacity: 0.7;
|
|
|
|
font-size: 14px;
|
|
|
|
padding-right: 40px;
|
|
|
|
padding-left: 8px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .actions {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
margin: auto 0;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|