2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-10-17 20:12:00 +09:00
|
|
|
<template>
|
2023-01-06 13:40:17 +09:00
|
|
|
<div class="_gaps_m">
|
2023-03-08 08:56:09 +09:00
|
|
|
<MkTab v-model="tab">
|
|
|
|
<option value="renoteMute">{{ i18n.ts.mutedUsers }} ({{ i18n.ts.renote }})</option>
|
2022-07-20 22:24:26 +09:00
|
|
|
<option value="mute">{{ i18n.ts.mutedUsers }}</option>
|
|
|
|
<option value="block">{{ i18n.ts.blockedUsers }}</option>
|
2020-11-17 14:59:15 +09:00
|
|
|
</MkTab>
|
2023-03-08 08:56:09 +09:00
|
|
|
|
|
|
|
<div v-if="tab === 'renoteMute'">
|
|
|
|
<MkPagination :pagination="renoteMutingPagination">
|
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
2023-06-09 14:00:53 +09:00
|
|
|
<img :src="infoImageUrl" class="_ghost"/>
|
2023-03-08 08:56:09 +09:00
|
|
|
<div>{{ i18n.ts.noUsers }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #default="{ items }">
|
|
|
|
<div class="_gaps_s">
|
|
|
|
<div v-for="item in items" :key="item.mutee.id" :class="[$style.userItem, { [$style.userItemOpend]: expandedRenoteMuteItems.includes(item.id) }]">
|
|
|
|
<div :class="$style.userItemMain">
|
2023-08-13 21:02:25 +09:00
|
|
|
<MkA :class="$style.userItemMainBody" :to="userPage(item.mutee)">
|
2023-03-08 08:56:09 +09:00
|
|
|
<MkUserCardMini :user="item.mutee"/>
|
|
|
|
</MkA>
|
|
|
|
<button class="_button" :class="$style.userToggle" @click="toggleRenoteMuteItem(item)"><i :class="$style.chevron" class="ti ti-chevron-down"></i></button>
|
|
|
|
<button class="_button" :class="$style.remove" @click="unrenoteMute(item.mutee, $event)"><i class="ti ti-x"></i></button>
|
|
|
|
</div>
|
|
|
|
<div v-if="expandedRenoteMuteItems.includes(item.id)" :class="$style.userItemSub">
|
|
|
|
<div>Muted at: <MkTime :time="item.createdAt" mode="detail"/></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-else-if="tab === 'mute'">
|
2023-03-07 09:37:02 +09:00
|
|
|
<MkPagination :pagination="mutingPagination">
|
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
2023-06-09 14:00:53 +09:00
|
|
|
<img :src="infoImageUrl" class="_ghost"/>
|
2023-03-07 09:37:02 +09:00
|
|
|
<div>{{ i18n.ts.noUsers }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #default="{ items }">
|
|
|
|
<div class="_gaps_s">
|
|
|
|
<div v-for="item in items" :key="item.mutee.id" :class="[$style.userItem, { [$style.userItemOpend]: expandedMuteItems.includes(item.id) }]">
|
|
|
|
<div :class="$style.userItemMain">
|
2023-08-13 21:02:25 +09:00
|
|
|
<MkA :class="$style.userItemMainBody" :to="userPage(item.mutee)">
|
2023-03-07 09:37:02 +09:00
|
|
|
<MkUserCardMini :user="item.mutee"/>
|
|
|
|
</MkA>
|
|
|
|
<button class="_button" :class="$style.userToggle" @click="toggleMuteItem(item)"><i :class="$style.chevron" class="ti ti-chevron-down"></i></button>
|
|
|
|
<button class="_button" :class="$style.remove" @click="unmute(item.mutee, $event)"><i class="ti ti-x"></i></button>
|
|
|
|
</div>
|
|
|
|
<div v-if="expandedMuteItems.includes(item.id)" :class="$style.userItemSub">
|
|
|
|
<div>Muted at: <MkTime :time="item.createdAt" mode="detail"/></div>
|
2023-07-20 10:54:41 +09:00
|
|
|
<div v-if="item.expiresAt">Period: {{ new Date(item.expiresAt).toLocaleString() }}</div>
|
2023-03-07 09:37:02 +09:00
|
|
|
<div v-else>Period: {{ i18n.ts.indefinitely }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</template>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
2023-03-08 08:56:09 +09:00
|
|
|
|
|
|
|
<div v-else-if="tab === 'block'">
|
2023-03-07 09:37:02 +09:00
|
|
|
<MkPagination :pagination="blockingPagination">
|
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
2023-06-09 14:00:53 +09:00
|
|
|
<img :src="infoImageUrl" class="_ghost"/>
|
2023-03-07 09:37:02 +09:00
|
|
|
<div>{{ i18n.ts.noUsers }}</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<template #default="{ items }">
|
|
|
|
<div class="_gaps_s">
|
|
|
|
<div v-for="item in items" :key="item.blockee.id" :class="[$style.userItem, { [$style.userItemOpend]: expandedBlockItems.includes(item.id) }]">
|
|
|
|
<div :class="$style.userItemMain">
|
2023-08-13 21:02:25 +09:00
|
|
|
<MkA :class="$style.userItemMainBody" :to="userPage(item.blockee)">
|
2023-03-07 09:37:02 +09:00
|
|
|
<MkUserCardMini :user="item.blockee"/>
|
|
|
|
</MkA>
|
|
|
|
<button class="_button" :class="$style.userToggle" @click="toggleBlockItem(item)"><i :class="$style.chevron" class="ti ti-chevron-down"></i></button>
|
|
|
|
<button class="_button" :class="$style.remove" @click="unblock(item.blockee, $event)"><i class="ti ti-x"></i></button>
|
|
|
|
</div>
|
|
|
|
<div v-if="expandedBlockItems.includes(item.id)" :class="$style.userItemSub">
|
|
|
|
<div>Blocked at: <MkTime :time="item.createdAt" mode="detail"/></div>
|
2023-07-20 10:54:41 +09:00
|
|
|
<div v-if="item.expiresAt">Period: {{ new Date(item.expiresAt).toLocaleString() }}</div>
|
2023-03-07 09:37:02 +09:00
|
|
|
<div v-else>Period: {{ i18n.ts.indefinitely }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</template>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
2022-01-04 17:58:53 +09:00
|
|
|
</div>
|
2020-10-17 20:12:00 +09:00
|
|
|
</template>
|
|
|
|
|
2022-01-15 17:58:35 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2022-08-31 00:24:33 +09:00
|
|
|
import MkTab from '@/components/MkTab.vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import FormInfo from '@/components/MkInfo.vue';
|
2022-01-04 17:58:53 +09:00
|
|
|
import FormLink from '@/components/form/link.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import { userPage } from '@/filters/user';
|
2022-01-15 17:58:35 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2023-03-07 09:37:02 +09:00
|
|
|
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
|
|
|
import * as os from '@/os';
|
2023-06-09 14:00:53 +09:00
|
|
|
import { infoImageUrl } from '@/instance';
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2023-03-08 08:56:09 +09:00
|
|
|
let tab = $ref('renoteMute');
|
|
|
|
|
|
|
|
const renoteMutingPagination = {
|
|
|
|
endpoint: 'renote-mute/list' as const,
|
|
|
|
limit: 10,
|
|
|
|
};
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-01-15 17:58:35 +09:00
|
|
|
const mutingPagination = {
|
|
|
|
endpoint: 'mute/list' as const,
|
|
|
|
limit: 10,
|
|
|
|
};
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-01-15 17:58:35 +09:00
|
|
|
const blockingPagination = {
|
|
|
|
endpoint: 'blocking/list' as const,
|
|
|
|
limit: 10,
|
|
|
|
};
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2023-03-08 08:56:09 +09:00
|
|
|
let expandedRenoteMuteItems = $ref([]);
|
2023-03-07 09:37:02 +09:00
|
|
|
let expandedMuteItems = $ref([]);
|
|
|
|
let expandedBlockItems = $ref([]);
|
|
|
|
|
2023-03-08 08:56:09 +09:00
|
|
|
async function unrenoteMute(user, ev) {
|
|
|
|
os.popupMenu([{
|
|
|
|
text: i18n.ts.renoteUnmute,
|
|
|
|
icon: 'ti ti-x',
|
|
|
|
action: async () => {
|
|
|
|
await os.apiWithDialog('renote-mute/delete', { userId: user.id });
|
|
|
|
//role.users = role.users.filter(u => u.id !== user.id);
|
|
|
|
},
|
|
|
|
}], ev.currentTarget ?? ev.target);
|
|
|
|
}
|
|
|
|
|
2023-03-07 09:37:02 +09:00
|
|
|
async function unmute(user, ev) {
|
|
|
|
os.popupMenu([{
|
|
|
|
text: i18n.ts.unmute,
|
|
|
|
icon: 'ti ti-x',
|
|
|
|
action: async () => {
|
|
|
|
await os.apiWithDialog('mute/delete', { userId: user.id });
|
|
|
|
//role.users = role.users.filter(u => u.id !== user.id);
|
|
|
|
},
|
|
|
|
}], ev.currentTarget ?? ev.target);
|
|
|
|
}
|
|
|
|
|
|
|
|
async function unblock(user, ev) {
|
|
|
|
os.popupMenu([{
|
|
|
|
text: i18n.ts.unblock,
|
|
|
|
icon: 'ti ti-x',
|
|
|
|
action: async () => {
|
|
|
|
await os.apiWithDialog('blocking/delete', { userId: user.id });
|
|
|
|
//role.users = role.users.filter(u => u.id !== user.id);
|
|
|
|
},
|
|
|
|
}], ev.currentTarget ?? ev.target);
|
|
|
|
}
|
|
|
|
|
2023-03-08 08:56:09 +09:00
|
|
|
async function toggleRenoteMuteItem(item) {
|
|
|
|
if (expandedRenoteMuteItems.includes(item.id)) {
|
|
|
|
expandedRenoteMuteItems = expandedRenoteMuteItems.filter(x => x !== item.id);
|
|
|
|
} else {
|
|
|
|
expandedRenoteMuteItems.push(item.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-07 09:37:02 +09:00
|
|
|
async function toggleMuteItem(item) {
|
|
|
|
if (expandedMuteItems.includes(item.id)) {
|
|
|
|
expandedMuteItems = expandedMuteItems.filter(x => x !== item.id);
|
|
|
|
} else {
|
|
|
|
expandedMuteItems.push(item.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async function toggleBlockItem(item) {
|
|
|
|
if (expandedBlockItems.includes(item.id)) {
|
|
|
|
expandedBlockItems = expandedBlockItems.filter(x => x !== item.id);
|
|
|
|
} else {
|
|
|
|
expandedBlockItems.push(item.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.muteAndBlock,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-ban',
|
2020-10-17 20:12:00 +09:00
|
|
|
});
|
|
|
|
</script>
|
2023-03-07 09:37:02 +09:00
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.userItemMain {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.userItemSub {
|
|
|
|
padding: 6px 12px;
|
|
|
|
font-size: 85%;
|
|
|
|
color: var(--fgTransparentWeak);
|
|
|
|
}
|
|
|
|
|
|
|
|
.userItemMainBody {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
margin-right: 8px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.userToggle,
|
|
|
|
.remove {
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
align-self: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.chevron {
|
|
|
|
display: block;
|
|
|
|
transition: transform 0.1s ease-out;
|
|
|
|
}
|
|
|
|
|
|
|
|
.userItem.userItemOpend {
|
|
|
|
.chevron {
|
|
|
|
transform: rotateX(180deg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|