2023-07-27 08:31:52 +03:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2022-07-07 14:19:50 +03:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader/></template>
|
2023-05-19 10:20:53 +03:00
|
|
|
<MkSpacer :contentMax="800">
|
2022-07-07 14:19:50 +03:00
|
|
|
<MkPagination ref="paginationComponent" :pagination="pagination">
|
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
2023-06-09 08:00:53 +03:00
|
|
|
<img :src="infoImageUrl" class="_ghost"/>
|
2022-07-20 16:24:26 +03:00
|
|
|
<div>{{ i18n.ts.noFollowRequests }}</div>
|
2022-07-07 14:19:50 +03:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #default="{items}">
|
|
|
|
<div class="mk-follow-requests">
|
|
|
|
<div v-for="req in items" :key="req.id" class="user _panel">
|
2023-01-16 07:18:11 +02:00
|
|
|
<MkAvatar class="avatar" :user="req.follower" indicator link preview/>
|
2022-07-07 14:19:50 +03:00
|
|
|
<div class="body">
|
|
|
|
<div class="name">
|
2023-02-08 13:07:19 +02:00
|
|
|
<MkA v-user-preview="req.follower.id" class="name" :to="userPage(req.follower)"><MkUserName :user="req.follower"/></MkA>
|
2022-07-07 14:19:50 +03:00
|
|
|
<p class="acct">@{{ acct(req.follower) }}</p>
|
|
|
|
</div>
|
2023-03-09 05:17:34 +02:00
|
|
|
<div class="commands">
|
|
|
|
<MkButton class="command" rounded primary @click="accept(req.follower)"><i class="ti ti-check"/> {{ i18n.ts.accept }}</MkButton>
|
|
|
|
<MkButton class="command" rounded danger @click="reject(req.follower)"><i class="ti ti-x"/> {{ i18n.ts.reject }}</MkButton>
|
2022-07-07 14:19:50 +03:00
|
|
|
</div>
|
2022-01-12 19:21:43 +02:00
|
|
|
</div>
|
2020-02-15 01:42:21 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-07-07 14:19:50 +03:00
|
|
|
</template>
|
|
|
|
</MkPagination>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-01-29 21:37:25 +02:00
|
|
|
</template>
|
|
|
|
|
2022-01-12 19:21:43 +02:00
|
|
|
<script lang="ts" setup>
|
2023-01-03 06:37:32 +02:00
|
|
|
import { shallowRef, computed } from 'vue';
|
2022-09-06 12:21:49 +03:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2023-03-09 05:17:34 +02:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { userPage, acct } from '@/filters/user.js';
|
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|
|
|
import { infoImageUrl } from '@/instance.js';
|
2022-01-12 19:21:43 +02:00
|
|
|
|
2023-01-03 06:37:32 +02:00
|
|
|
const paginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
|
2022-01-12 19:21:43 +02:00
|
|
|
|
|
|
|
const pagination = {
|
2022-01-12 19:26:10 +02:00
|
|
|
endpoint: 'following/requests/list' as const,
|
2022-01-12 19:21:43 +02:00
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2022-01-12 19:21:43 +02:00
|
|
|
function accept(user) {
|
|
|
|
os.api('following/requests/accept', { userId: user.id }).then(() => {
|
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2022-01-12 19:21:43 +02:00
|
|
|
function reject(user) {
|
|
|
|
os.api('following/requests/reject', { userId: user.id }).then(() => {
|
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 11:38:49 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 11:38:49 +03:00
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: i18n.ts.followRequests,
|
2022-12-26 10:15:30 +02:00
|
|
|
icon: 'ti ti-user-plus',
|
2022-06-20 11:38:49 +03:00
|
|
|
})));
|
2020-01-29 21:37:25 +02:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 11:29:39 +02:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 21:37:25 +02:00
|
|
|
.mk-follow-requests {
|
|
|
|
> .user {
|
|
|
|
display: flex;
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> .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;
|
2023-03-09 05:17:34 +02:00
|
|
|
flex-wrap: wrap;
|
|
|
|
gap: 8px;
|
2020-01-29 21:37:25 +02:00
|
|
|
|
|
|
|
> .name {
|
2023-03-09 05:17:34 +02:00
|
|
|
flex: 1 1 50%;
|
2020-01-29 21:37:25 +02:00
|
|
|
|
|
|
|
> .name,
|
|
|
|
> .acct {
|
|
|
|
display: block;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
2021-03-02 15:57:16 +02:00
|
|
|
overflow: hidden;
|
2020-01-29 21:37:25 +02: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 15:57:16 +02:00
|
|
|
overflow: hidden;
|
2020-01-29 21:37:25 +02: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-09 05:17:34 +02:00
|
|
|
> .commands {
|
|
|
|
display: flex;
|
|
|
|
gap: 8px;
|
|
|
|
}
|
|
|
|
|
2020-01-29 21:37:25 +02:00
|
|
|
> .actions {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
margin: auto 0;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|