merge: Report admin UX improvements (!1060)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/1060

Approved-by: Marie <github@yuugi.dev>
Approved-by: dakkar <dakkar@thenautilus.net>
This commit is contained in:
Hazelnoot 2025-06-05 08:00:32 +00:00
commit f88253b95f
27 changed files with 846 additions and 135 deletions

View file

@ -4,8 +4,8 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<PageWithHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs">
<div class="_spacer" style="--MI_SPACER-w: 600px; --MI_SPACER-min: 16px; --MI_SPACER-max: 32px;">
<PageWithHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs" :spacer="true" style="--MI_SPACER-w: 600px; --MI_SPACER-min: 16px; --MI_SPACER-max: 32px;">
<div>
<FormSuspense :p="init">
<div v-if="tab === 'overview'" class="_gaps">
<div v-if="user" class="aeakzknw">
@ -273,8 +273,14 @@ import SkBadgeStrip from '@/components/SkBadgeStrip.vue';
const props = withDefaults(defineProps<{
userId: string;
initialTab?: string;
userHint?: Misskey.entities.UserDetailed;
infoHint?: Misskey.entities.AdminShowUserResponse;
ipsHint?: Misskey.entities.AdminGetUserIpsResponse;
}>(), {
initialTab: 'overview',
userHint: undefined,
infoHint: undefined,
ipsHint: undefined,
});
const tab = ref(props.initialTab);
@ -405,16 +411,23 @@ const announcementsPagination = {
};
const expandedRoles = ref([]);
function createFetcher() {
return () => Promise.all([misskeyApi('users/show', {
userId: props.userId,
}), misskeyApi('admin/show-user', {
userId: props.userId,
}), iAmAdmin ? misskeyApi('admin/get-user-ips', {
userId: props.userId,
}) : Promise.resolve(null), iAmAdmin ? misskeyApi('ap/get', {
uri: `${url}/users/${props.userId}`,
}).catch(() => null) : null]).then(([_user, _info, _ips, _ap]) => {
function createFetcher(withHint = true) {
return () => Promise.all([
(withHint && props.userHint) ? props.userHint : misskeyApi('users/show', {
userId: props.userId,
}),
(withHint && props.infoHint) ? props.infoHint : misskeyApi('admin/show-user', {
userId: props.userId,
}),
iAmAdmin
? (withHint && props.ipsHint) ? props.ipsHint : misskeyApi('admin/get-user-ips', {
userId: props.userId,
})
: null,
iAmAdmin ? misskeyApi('ap/get', {
uri: `${url}/users/${props.userId}`,
}).catch(() => null) : null],
).then(([_user, _info, _ips, _ap]) => {
user.value = _user;
info.value = _info;
ips.value = _ips;
@ -432,7 +445,7 @@ function createFetcher() {
async function refreshUser() {
// Not a typo - createFetcher() returns a function()
await createFetcher()();
await createFetcher(false)();
}
async function onMandatoryCWChanged(value: string) {

View file

@ -48,9 +48,9 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<MkPagination v-slot="{items}" ref="reports" :pagination="pagination" :displayLimit="50">
<div class="_gaps">
<XAbuseReport v-for="report in items" :key="report.id" :report="report" @resolved="resolved"/>
</div>
<SkDateSeparatedList v-slot="{ item: report }" :items="items">
<XAbuseReport :report="report" @resolved="resolved"/>
</SkDateSeparatedList>
</MkPagination>
</div>
</div>
@ -67,6 +67,7 @@ import { definePage } from '@/page.js';
import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue';
import { store } from '@/store.js';
import SkDateSeparatedList from '@/components/SkDateSeparatedList.vue';
const reports = useTemplateRef('reports');

View file

@ -4,8 +4,8 @@ SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<PageWithHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs" :swipable="true">
<div v-if="instance" class="_spacer" style="--MI_SPACER-w: 600px; --MI_SPACER-min: 16px; --MI_SPACER-max: 32px;">
<PageWithHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs" :spacer="true" style="--MI_SPACER-w: 600px; --MI_SPACER-min: 16px; --MI_SPACER-max: 32px;">
<div v-if="instance">
<!-- This empty div is preserved to avoid merge conflicts -->
<div>
<div v-if="tab === 'overview'" class="_gaps">
@ -238,9 +238,14 @@ import SkBadgeStrip from '@/components/SkBadgeStrip.vue';
const $style = useCssModule();
const props = defineProps<{
const props = withDefaults(defineProps<{
host: string;
}>();
metaHint?: Misskey.entities.AdminMetaResponse;
instanceHint?: Misskey.entities.FederationInstance;
}>(), {
metaHint: undefined,
instanceHint: undefined,
});
const tab = ref('overview');
@ -363,12 +368,16 @@ async function saveModerationNote() {
}
}
async function fetch(): Promise<void> {
async function fetch(withHint = false): Promise<void> {
const [m, i] = await Promise.all([
iAmAdmin ? misskeyApi('admin/meta') : null,
misskeyApi('federation/show-instance', {
host: props.host,
}),
(withHint && props.metaHint)
? props.metaHint
: iAmAdmin ? misskeyApi('admin/meta') : null,
(withHint && props.instanceHint)
? props.instanceHint
: misskeyApi('federation/show-instance', {
host: props.host,
}),
]);
meta.value = m;
instance.value = i;
@ -531,7 +540,7 @@ async function severAllFollowRelations(): Promise<void> {
});
}
fetch();
fetch(true);
const headerActions = computed(() => [{
text: `https://${props.host}`,