feat(account-migration): アカウント移行ログのフィルターを追加 (MisskeyIO#919)

This commit is contained in:
まっちゃてぃー。 2025-02-01 22:57:18 +09:00 committed by GitHub
parent 43e5b8d5f8
commit ff85d650bf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 82 additions and 8 deletions

View file

@ -1498,7 +1498,9 @@ _accountMigration:
migrationConfirm: "Really migrate this account to {account}? Once started, this process cannot be stopped or taken back, and you will not be able to use this account in its original state anymore."
movedAndCannotBeUndone: "\nThis account has been migrated.\nMigration cannot be reversed."
postMigrationNote: "This account will unfollow all accounts it is currently following 24 hours after migration finishes.\nBoth the number of follows and followers will then become zero. To avoid your followers from being unable to see followers only posts of this account, they will however continue following this account."
movedTo: "New account:"
movedTo: "Migrated account:"
movedToServer: "Migrated server"
movedFromServer: "Original server"
_achievements:
earnedAt: "Unlocked at"
_types:

8
locales/index.d.ts vendored
View file

@ -6004,6 +6004,14 @@ export interface Locale extends ILocale {
* :
*/
"movedTo": string;
/**
*
*/
"movedToServer": string;
/**
*
*/
"movedFromServer": string;
};
"_achievements": {
/**

View file

@ -1511,6 +1511,8 @@ _accountMigration:
movedAndCannotBeUndone: "\nアカウントは移行されています。\n移行を取り消すことはできません。"
postMigrationNote: "このアカウントからのフォロー解除は移行操作から24時間後に実行されます。\nこのアカウントのフォロー・フォロワー数は0になっています。フォロワーの解除はされないため、あなたのフォロワーはこのアカウントのフォロワー向け投稿を引き続き閲覧できます。"
movedTo: "移行先のアカウント:"
movedToServer: "移行先のサーバー"
movedFromServer: "移行元のサーバー"
_achievements:
earnedAt: "獲得日時"

View file

@ -1496,6 +1496,8 @@ _accountMigration:
movedAndCannotBeUndone: "\n이사한 계정입니다.\n이사는 취소할 수 없습니다."
postMigrationNote: "이 계정의 팔로잉 해제는 이사 후 24시간 뒤에 실행됩니다.\n이 계정의 팔로우 및 팔로워 수는 0으로 표시됩니다. 팔로워 해제는 이루어지지 않으므로, 당신의 팔로워는 이 계정의 팔로워 한정 게시물을 계속해서 열람할 수 있습니다."
movedTo: "이사할 계정:"
movedToServer: "이사한 서버"
movedFromServer: "기존 서버"
_achievements:
earnedAt: "달성 일시"
_types:

View file

@ -62,6 +62,8 @@ export const paramDef = {
untilId: { type: 'string', format: 'misskey:id' },
movedFromId: { type: 'string', format: 'misskey:id', nullable: true },
movedToId: { type: 'string', format: 'misskey:id', nullable: true },
from: { type: 'string', enum: ['local', 'remote', 'all'], nullable: true },
to: { type: 'string', enum: ['local', 'remote', 'all'], nullable: true },
},
required: [],
} as const;
@ -86,6 +88,28 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
query.andWhere('accountMoveLogs.movedToId = :movedToId', { movedToId: ps.movedToId });
}
if (ps.from != null || ps.to != null) {
query
.innerJoin('accountMoveLogs.movedFrom', 'movedFrom')
.innerJoin('accountMoveLogs.movedTo', 'movedTo');
if (ps.from === 'local') {
query.andWhere('movedFrom.host IS NULL');
}
if (ps.from === 'remote') {
query.andWhere('movedFrom.host IS NOT NULL');
}
if (ps.to === 'local') {
query.andWhere('movedTo.host IS NULL');
}
if (ps.to === 'remote') {
query.andWhere('movedTo.host IS NOT NULL');
}
}
const accountMoveLogs = await query.limit(ps.limit).getMany();
return await this.userAccountMoveLogEntityService.packMany(accountMoveLogs, me);

View file

@ -2,13 +2,29 @@
<MkStickyContainer>
<template #header><XHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :contentMax="900">
<div style="display: flex; gap: var(--margin); flex-wrap: wrap;">
<MkInput v-model="movedFromId" style="margin: 0; flex: 1;">
<template #label> {{ i18n.ts.moveFromId }}</template>
</MkInput>
<MkInput v-model="movedToId" style="margin: 0; flex: 1;">
<template #label> {{ i18n.ts.movedToId }}</template>
</MkInput>
<div style="display: flex; flex-direction: column; gap: var(--margin); flex-wrap: wrap;">
<div :class="$style.inputs">
<MkSelect v-model="from" :class="$style.input">
<template #label>{{ i18n.ts._accountMigration.movedFromServer }}</template>
<option value="all">{{ i18n.ts.all }}</option>
<option value="remote">{{ i18n.ts.remote }}</option>
<option value="local">{{ i18n.ts.local }}</option>
</MkSelect>
<MkSelect v-model="to" :class="$style.input">
<template #label>{{ i18n.ts._accountMigration.movedToServer }}</template>
<option value="all">{{ i18n.ts.all }}</option>
<option value="remote">{{ i18n.ts.remote }}</option>
<option value="local">{{ i18n.ts.local }}</option>
</MkSelect>
</div>
<div :class="$style.inputs">
<MkInput v-model="movedFromId" :class="$style.input">
<template #label> {{ i18n.ts.moveFromId }}</template>
</MkInput>
<MkInput v-model="movedToId" :class="$style.input">
<template #label> {{ i18n.ts.movedToId }}</template>
</MkInput>
</div>
</div>
<MkPagination v-slot="{items}" ref="logs" :pagination="pagination" style="margin-top: var(--margin);">
@ -48,11 +64,15 @@ import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { userPage } from '@/filters/user.js';
import MkFolder from '@/components/MkFolder.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import MkSelect from '@/components/MkSelect.vue';
const logs = shallowRef<InstanceType<typeof MkPagination>>();
const movedToId = ref('');
const movedFromId = ref('');
const from = ref('all');
const to = ref('all');
const pagination = {
endpoint: 'admin/show-user-account-move-logs' as const,
@ -60,6 +80,8 @@ const pagination = {
params: computed(() => ({
movedFromId: movedFromId.value === '' ? null : movedFromId.value,
movedToId: movedToId.value === '' ? null : movedToId.value,
from: from.value,
to: to.value,
})),
};
@ -95,4 +117,14 @@ definePageMetadata(() => ({
flex-direction: column;
}
.inputs {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.input {
margin: 0;
flex: 1;
}
</style>

View file

@ -9699,6 +9699,10 @@ export type operations = {
movedFromId?: string | null;
/** Format: misskey:id */
movedToId?: string | null;
/** @enum {string|null} */
from?: 'local' | 'remote' | 'all';
/** @enum {string|null} */
to?: 'local' | 'remote' | 'all';
};
};
};