Skip to content

Commit

Permalink
feat(account-migration): アカウント移行ログのフィルターを追加 (#919)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyatea authored Feb 1, 2025
1 parent 43e5b8d commit ff85d65
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 8 deletions.
4 changes: 3 additions & 1 deletion locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6004,6 +6004,14 @@ export interface Locale extends ILocale {
* 移行先のアカウント:
*/
"movedTo": string;
/**
* 移行先のサーバー
*/
"movedToServer": string;
/**
* 移行元のサーバー
*/
"movedFromServer": string;
};
"_achievements": {
/**
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,8 @@ _accountMigration:
movedAndCannotBeUndone: "\nアカウントは移行されています。\n移行を取り消すことはできません。"
postMigrationNote: "このアカウントからのフォロー解除は移行操作から24時間後に実行されます。\nこのアカウントのフォロー・フォロワー数は0になっています。フォロワーの解除はされないため、あなたのフォロワーはこのアカウントのフォロワー向け投稿を引き続き閲覧できます。"
movedTo: "移行先のアカウント:"
movedToServer: "移行先のサーバー"
movedFromServer: "移行元のサーバー"

_achievements:
earnedAt: "獲得日時"
Expand Down
2 changes: 2 additions & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,8 @@ _accountMigration:
movedAndCannotBeUndone: "\n이사한 계정입니다.\n이사는 취소할 수 없습니다."
postMigrationNote: "이 계정의 팔로잉 해제는 이사 후 24시간 뒤에 실행됩니다.\n이 계정의 팔로우 및 팔로워 수는 0으로 표시됩니다. 팔로워 해제는 이루어지지 않으므로, 당신의 팔로워는 이 계정의 팔로워 한정 게시물을 계속해서 열람할 수 있습니다."
movedTo: "이사할 계정:"
movedToServer: "이사한 서버"
movedFromServer: "기존 서버"
_achievements:
earnedAt: "달성 일시"
_types:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
46 changes: 39 additions & 7 deletions packages/frontend/src/pages/admin/useraccountmovelog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);">
Expand Down Expand Up @@ -48,18 +64,24 @@ 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,
limit: 30,
params: computed(() => ({
movedFromId: movedFromId.value === '' ? null : movedFromId.value,
movedToId: movedToId.value === '' ? null : movedToId.value,
from: from.value,
to: to.value,
})),
};
Expand Down Expand Up @@ -95,4 +117,14 @@ definePageMetadata(() => ({
flex-direction: column;
}
.inputs {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.input {
margin: 0;
flex: 1;
}
</style>
4 changes: 4 additions & 0 deletions packages/misskey-js/src/autogen/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
};
};
};
Expand Down

0 comments on commit ff85d65

Please sign in to comment.