2020-01-29 21:37:25 +02:00
|
|
|
<template>
|
2020-02-15 01:42:21 +02:00
|
|
|
<div>
|
2020-10-17 14:12:00 +03:00
|
|
|
<MkPagination :pagination="pagination" class="mk-follow-requests" ref="list">
|
2020-02-15 01:42:21 +02:00
|
|
|
<template #empty>
|
2020-03-28 12:33:11 +02:00
|
|
|
<div class="_fullinfo">
|
2020-03-23 12:06:46 +02:00
|
|
|
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
|
2020-12-26 03:47:36 +02:00
|
|
|
<div>{{ $ts.noFollowRequests }}</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-02-15 01:42:21 +02:00
|
|
|
</template>
|
|
|
|
<template #default="{items}">
|
|
|
|
<div class="user _panel" v-for="req in items" :key="req.id">
|
2020-10-17 14:12:00 +03:00
|
|
|
<MkAvatar class="avatar" :user="req.follower"/>
|
2020-02-15 01:42:21 +02:00
|
|
|
<div class="body">
|
|
|
|
<div class="name">
|
2020-10-24 19:21:41 +03:00
|
|
|
<MkA class="name" :to="userPage(req.follower)" v-user-preview="req.follower.id"><MkUserName :user="req.follower"/></MkA>
|
2020-10-17 14:12:00 +03:00
|
|
|
<p class="acct">@{{ acct(req.follower) }}</p>
|
2020-02-15 01:42:21 +02:00
|
|
|
</div>
|
|
|
|
<div class="description" v-if="req.follower.description" :title="req.follower.description">
|
2020-12-19 03:55:52 +02:00
|
|
|
<Mfm :text="req.follower.description" :is-note="false" :author="req.follower" :i="$i" :custom-emojis="req.follower.emojis" :plain="true" :nowrap="true"/>
|
2020-02-15 01:42:21 +02:00
|
|
|
</div>
|
|
|
|
<div class="actions">
|
2020-10-17 14:12:00 +03:00
|
|
|
<button class="_button" @click="accept(req.follower)"><Fa :icon="faCheck"/></button>
|
|
|
|
<button class="_button" @click="reject(req.follower)"><Fa :icon="faTimes"/></button>
|
2020-02-15 01:42:21 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</div>
|
2020-02-15 01:42:21 +02:00
|
|
|
</template>
|
2020-10-17 14:12:00 +03:00
|
|
|
</MkPagination>
|
2020-02-15 01:42:21 +02:00
|
|
|
</div>
|
2020-01-29 21:37:25 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2020-10-17 14:12:00 +03:00
|
|
|
import { defineComponent } from 'vue';
|
2020-02-15 01:42:21 +02:00
|
|
|
import { faUserClock, faCheck, faTimes } from '@fortawesome/free-solid-svg-icons';
|
2020-10-17 14:12:00 +03:00
|
|
|
import MkPagination from '@/components/ui/pagination.vue';
|
|
|
|
import { userPage, acct } from '../filters/user';
|
|
|
|
import * as os from '@/os';
|
2020-01-29 21:37:25 +02:00
|
|
|
|
2020-10-17 14:12:00 +03:00
|
|
|
export default defineComponent({
|
2020-01-29 21:37:25 +02:00
|
|
|
components: {
|
|
|
|
MkPagination
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2020-10-17 14:12:00 +03:00
|
|
|
INFO: {
|
2020-12-26 03:47:36 +02:00
|
|
|
title: this.$ts.followRequests,
|
2020-11-03 13:36:12 +02:00
|
|
|
icon: faUserClock,
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
2020-01-29 21:37:25 +02:00
|
|
|
pagination: {
|
|
|
|
endpoint: 'following/requests/list',
|
|
|
|
limit: 10,
|
|
|
|
},
|
2020-02-15 01:42:21 +02:00
|
|
|
faCheck, faTimes, faUserClock
|
2020-01-29 21:37:25 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
accept(user) {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.api('following/requests/accept', { userId: user.id }).then(() => {
|
2020-01-29 21:37:25 +02:00
|
|
|
this.$refs.list.reload();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
reject(user) {
|
2020-10-17 14:12:00 +03:00
|
|
|
os.api('following/requests/reject', { userId: user.id }).then(() => {
|
2020-01-29 21:37:25 +02:00
|
|
|
this.$refs.list.reload();
|
|
|
|
});
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
|
|
|
userPage,
|
|
|
|
acct
|
2020-01-29 21:37:25 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.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;
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
width: 45%;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .name,
|
|
|
|
> .acct {
|
|
|
|
display: block;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
2021-02-27 04:18:53 +02:00
|
|
|
overflow: hidden; // overflow: clip; をSafariが対応したら消す
|
|
|
|
overflow: clip;
|
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-02-27 04:18:53 +02:00
|
|
|
overflow: hidden; // overflow: clip; をSafariが対応したら消す
|
|
|
|
overflow: clip;
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .actions {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
margin: auto 0;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|