This commit is contained in:
syuilo 2024-10-04 10:18:36 +09:00
parent a08a38c29a
commit c1597be458
6 changed files with 83 additions and 79 deletions

View File

@ -4,64 +4,98 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div class="bcekxzvu _margin _panel"> <MkFolder>
<div class="target"> <template #icon>
<MkA v-user-preview="report.targetUserId" class="info" :to="`/admin/user/${report.targetUserId}`" :behavior="'window'"> <i v-if="report.resolved" class="ti ti-check" style="color: var(--success)"></i>
<MkAvatar class="avatar" :user="report.targetUser" indicator/> <i v-else class="ti ti-exclamation-circle" style="color: var(--warn)"></i>
<div class="names"> </template>
<MkUserName class="name" :user="report.targetUser"/> <template #label><MkAcct :user="report.targetUser"/> (by <MkAcct :user="report.reporter"/>)</template>
<MkAcct class="acct" :user="report.targetUser" style="display: block;"/> <template #suffix><MkTime :time="report.createdAt"/></template>
<template v-if="!report.resolved" #footer>
<div class="_buttons">
<MkButton primary @click="resolve">{{ i18n.ts.abuseMarkAsResolved }}</MkButton>
<template v-if="report.targetUser.host == null || report.resolved">
<MkButton primary @click="resolveAndForward">{{ i18n.ts.forwardReport }}</MkButton>
<div v-tooltip:dialog="i18n.ts.forwardReportIsAnonymous" class="_button _help"><i class="ti ti-help-circle"></i></div>
</template>
</div> </div>
</MkA> </template>
<MkKeyValue>
<template #key>{{ i18n.ts.registeredDate }}</template> <div :class="$style.root" class="_gaps_s">
<template #value>{{ dateString(report.targetUser.createdAt) }} (<MkTime :time="report.targetUser.createdAt"/>)</template> <MkFolder :withSpacer="false">
</MkKeyValue> <template #icon><MkAvatar :user="report.targetUser" style="width: 18px; height: 18px;"/></template>
<template #label>Target: <MkAcct :user="report.targetUser"/></template>
<template #suffix>#{{ report.targetUserId.toUpperCase() }}</template>
<div style="container-type: inline-size;">
<RouterView :router="targetRouter"/>
</div> </div>
<div class="detail"> </MkFolder>
<MkFolder :defaultOpen="true">
<template #icon><i class="ti ti-message-2"></i></template>
<template #label>{{ i18n.ts.details }}</template>
<div> <div>
<Mfm :text="report.comment" :linkNavigationBehavior="'window'"/> <Mfm :text="report.comment" :linkNavigationBehavior="'window'"/>
</div> </div>
<hr/> </MkFolder>
<div>{{ i18n.ts.reporter }}: <MkA :to="`/admin/user/${report.reporter.id}`" class="_link" :behavior="'window'">@{{ report.reporter.username }}</MkA></div>
<MkFolder :withSpacer="false">
<template #icon><MkAvatar :user="report.reporter" style="width: 18px; height: 18px;"/></template>
<template #label>{{ i18n.ts.reporter }}: <MkAcct :user="report.reporter"/></template>
<template #suffix>#{{ report.reporterId.toUpperCase() }}</template>
<div style="container-type: inline-size;">
<RouterView :router="reporterRouter"/>
</div>
</MkFolder>
<div v-if="report.assignee"> <div v-if="report.assignee">
{{ i18n.ts.moderator }}: {{ i18n.ts.moderator }}:
<MkAcct :user="report.assignee"/> <MkAcct :user="report.assignee"/>
</div> </div>
<div><MkTime :time="report.createdAt"/></div>
<div class="action">
<MkSwitch v-model="forward" :disabled="report.targetUser.host == null || report.resolved">
{{ i18n.ts.forwardReport }}
<template #caption>{{ i18n.ts.forwardReportIsAnonymous }}</template>
</MkSwitch>
<MkButton v-if="!report.resolved" primary @click="resolve">{{ i18n.ts.abuseMarkAsResolved }}</MkButton>
</div>
</div>
</div> </div>
</MkFolder>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { provide, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import MkKeyValue from '@/components/MkKeyValue.vue'; import MkKeyValue from '@/components/MkKeyValue.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { dateString } from '@/filters/date.js'; import { dateString } from '@/filters/date.js';
import MkFolder from '@/components/MkFolder.vue';
import RouterView from '@/components/global/RouterView.vue';
import { useRouterFactory } from '@/router/supplier';
const props = defineProps<{ const props = defineProps<{
report: any; report: Misskey.entities.AdminAbuseUserReportsResponse[number];
}>(); }>();
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'resolved', reportId: string): void; (ev: 'resolved', reportId: string): void;
}>(); }>();
const forward = ref(props.report.forwarded); const routerFactory = useRouterFactory();
const targetRouter = routerFactory(`/admin/user/${props.report.targetUserId}`);
targetRouter.init();
const reporterRouter = routerFactory(`/admin/user/${props.report.reporterId}`);
reporterRouter.init();
function resolve() { function resolve() {
os.apiWithDialog('admin/resolve-abuse-user-report', { os.apiWithDialog('admin/resolve-abuse-user-report', {
forward: forward.value, reportId: props.report.id,
}).then(() => {
emit('resolved', props.report.id);
});
}
function resolveAndForward() {
os.apiWithDialog('admin/resolve-abuse-user-report', {
forward: true,
reportId: props.report.id, reportId: props.report.id,
}).then(() => { }).then(() => {
emit('resolved', props.report.id); emit('resolved', props.report.id);
@ -69,47 +103,7 @@ function resolve() {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" module>
.bcekxzvu { .root {
display: flex;
> .target {
width: 35%;
box-sizing: border-box;
text-align: left;
padding: 24px;
border-right: solid 1px var(--divider);
> .info {
display: flex;
box-sizing: border-box;
align-items: center;
padding: 14px;
border-radius: 8px;
--c: rgb(255 196 0 / 15%);
background-image: linear-gradient(45deg, var(--c) 16.67%, transparent 16.67%, transparent 50%, var(--c) 50%, var(--c) 66.67%, transparent 66.67%, transparent 100%);
background-size: 16px 16px;
> .avatar {
width: 42px;
height: 42px;
}
> .names {
margin-left: 0.3em;
padding: 0 8px;
flex: 1;
> .name {
font-weight: bold;
}
}
}
}
> .detail {
flex: 1;
padding: 24px;
}
} }
</style> </style>

View File

@ -38,9 +38,12 @@ SPDX-License-Identifier: AGPL-3.0-only
> >
<KeepAlive> <KeepAlive>
<div v-show="opened"> <div v-show="opened">
<MkSpacer :marginMin="14" :marginMax="22"> <MkSpacer v-if="withSpacer" :marginMin="14" :marginMax="22">
<slot></slot> <slot></slot>
</MkSpacer> </MkSpacer>
<div v-else>
<slot></slot>
</div>
<div v-if="$slots.footer" :class="$style.footer"> <div v-if="$slots.footer" :class="$style.footer">
<slot name="footer"></slot> <slot name="footer"></slot>
</div> </div>
@ -59,9 +62,11 @@ import { defaultStore } from '@/store.js';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
defaultOpen?: boolean; defaultOpen?: boolean;
maxHeight?: number | null; maxHeight?: number | null;
withSpacer?: boolean;
}>(), { }>(), {
defaultOpen: false, defaultOpen: false,
maxHeight: null, maxHeight: null,
withSpacer: true,
}); });
const getBgColor = (el: HTMLElement) => { const getBgColor = (el: HTMLElement) => {

View File

@ -27,6 +27,7 @@ import MkLoadingPage from '@/pages/_loading_.vue';
const props = defineProps<{ const props = defineProps<{
router?: IRouter; router?: IRouter;
nested?: boolean;
}>(); }>();
const router = props.router ?? inject('router'); const router = props.router ?? inject('router');
@ -39,6 +40,8 @@ const currentDepth = inject('routerCurrentDepth', 0);
provide('routerCurrentDepth', currentDepth + 1); provide('routerCurrentDepth', currentDepth + 1);
function resolveNested(current: Resolved, d = 0): Resolved | null { function resolveNested(current: Resolved, d = 0): Resolved | null {
if (!props.nested) return current;
if (d === currentDepth) { if (d === currentDepth) {
return current; return current;
} else { } else {

View File

@ -44,8 +44,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
--> -->
<MkPagination v-slot="{items}" ref="reports" :pagination="pagination" style="margin-top: var(--margin);"> <MkPagination v-slot="{items}" ref="reports" :pagination="pagination">
<div class="_gaps">
<XAbuseReport v-for="report in items" :key="report.id" :report="report" @resolved="resolved"/> <XAbuseReport v-for="report in items" :key="report.id" :report="report" @resolved="resolved"/>
</div>
</MkPagination> </MkPagination>
</div> </div>
</MkSpacer> </MkSpacer>

View File

@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkSpacer> </MkSpacer>
</div> </div>
<div v-if="!(narrow && currentPage?.route.name == null)" class="main"> <div v-if="!(narrow && currentPage?.route.name == null)" class="main">
<RouterView/> <RouterView nested/>
</div> </div>
</div> </div>
</template> </template>

View File

@ -17,7 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<div v-if="!(narrow && currentPage?.route.name == null)" class="main"> <div v-if="!(narrow && currentPage?.route.name == null)" class="main">
<div class="bkzroven" style="container-type: inline-size;"> <div class="bkzroven" style="container-type: inline-size;">
<RouterView/> <RouterView nested/>
</div> </div>
</div> </div>
</div> </div>