Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ress@dc51c90))

  - `다이렉트 메시지` 및 `고정된 노트`와 관련된 파일을 제외한 모든 노트와 파일을 자동으로 삭제할 수 있음
  • Loading branch information
noridev committed Jan 3, 2025
1 parent 55fb445 commit d04b9c7
Show file tree
Hide file tree
Showing 21 changed files with 470 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2024xx](CHANGE
기반 Misskey 버전: 2024.x.x<br>
Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2024xx](CHANGELOG.md#2024xx) 문서를 참고하십시오.

### General
- Feat: 계정 정리 기능 ([yodangang-express/cherrypick@dc51c907](https://github.com/yodangang-express/cherrypick/commit/dc51c907236570d6f072409832d312c937239514))
- `다이렉트 메시지``고정된 노트`와 관련된 파일을 제외한 모든 노트와 파일을 자동으로 삭제할 수 있음

### Client
- Enhance: 사용자 페이지에서 `이름`, `자기소개`, `팔로우 메시지`, `추가 정보`에 포함된 외부 이모지를 가져올 수 있음
- Fix: 노트 헤더의 사용자 이름을 클릭하면 페이지가 중복으로 이동됨
Expand Down
9 changes: 9 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
_lang_: "English"
truncateAccount: "Truncate account"
truncateAccountConfirm: "All notes and files will be deleted except those associated with direct messages and pinned notes. Still continue?"
bubbleTimeline: "Bubble Timeline"
bubbleTimelineDescription: "After enabling this option navigate to the Moderation section to configure which servers should be shown."
bubbleInstancesDescription: "Set the host names of servers to be displayed in the bubble timeline, separated by line breaks."
Expand Down Expand Up @@ -3177,3 +3179,10 @@ _searchSite:
otherDescription: "Use other search engine"
query: "Query"
queryDescription: "Input query scheme for search engine. For example, if https://www.google.com/search?q=test, input 'q'."
_accountTruncate:
accountTruncate: "Truncate account"
mayTakeTime: "As account truncation is a resource-heavy process, it may take some time to complete depending on how much content you have created and how many files you have uploaded."
sendEmail: "Once account truncation has been completed, an email will be sent to the email address registered to this account."
requestAccountDelete: "Request account truncation"
started: "Truncation has been started."
inProgress: "Truncation is currently in progress"
34 changes: 34 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ export interface Locale extends ILocale {
* 日本語
*/
"_lang_": string;
/**
* アカウント整理
*/
"truncateAccount": string;
/**
* ダイレクトメッセージと固定されたノートに関連付けられているファイルを除くすべてのノートとファイルが削除されます。それでも続行しますか?
*/
"truncateAccountConfirm": string;
/**
* バブルタイムライン
*/
Expand Down Expand Up @@ -12388,6 +12396,32 @@ export interface Locale extends ILocale {
*/
"queryDescription": string;
};
"_accountTruncate": {
/**
* アカウントの整理
*/
"accountDelete": string;
/**
* アカウントの整理は負荷のかかる処理であるため、作成したコンテンツの数やアップロードしたファイルの数が多いと完了までに時間がかかることがあります。
*/
"mayTakeTime": string;
/**
* アカウントの整理が完了する際は、登録してあったメールアドレス宛に通知を送信します。
*/
"sendEmail": string;
/**
* アカウント整理をリクエスト
*/
"requestAccountTruncate": string;
/**
* 整理処理が開始されました。
*/
"started": string;
/**
* 整理が進行中
*/
"inProgress": string;
};
}
declare const locales: {
[lang: string]: Locale;
Expand Down
10 changes: 10 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
_lang_: "日本語"

truncateAccount: "アカウント整理"
truncateAccountConfirm: "ダイレクトメッセージと固定されたノートに関連付けられているファイルを除くすべてのノートとファイルが削除されます。それでも続行しますか?"
bubbleTimeline: "バブルタイムライン"
bubbleTimelineDescription: "このオプションを有効にし、モデレーションに移動して、表示するサーバを設定します。"
bubbleInstancesDescription: "バブルタイムラインに表示するサーバのホスト名を改行で区切って設定します。"
Expand Down Expand Up @@ -3305,3 +3307,11 @@ _searchSite:
otherDescription: "その他の検索エンジンを使用します。"
query: "検索クエリ"
queryDescription: "検索エンジンが使用するクエリを入力します。(例: https://www.google.com/search?q=test の場合qを入れる)"

_accountTruncate:
accountDelete: "アカウントの整理"
mayTakeTime: "アカウントの整理は負荷のかかる処理であるため、作成したコンテンツの数やアップロードしたファイルの数が多いと完了までに時間がかかることがあります。"
sendEmail: "アカウントの整理が完了する際は、登録してあったメールアドレス宛に通知を送信します。"
requestAccountTruncate: "アカウント整理をリクエスト"
started: "整理処理が開始されました。"
inProgress: "整理が進行中"
11 changes: 10 additions & 1 deletion locales/ko-KR.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
_lang_: "한국어"
truncateAccount: "계정 정리"
truncateAccountConfirm: "다이렉트 메시지 및 고정된 노트와 관련된 파일을 제외한 모든 노트와 파일이 삭제돼요. 그래도 계속할까요?"
bubbleTimeline: "버블 타임라인"
bubbleTimelineDescription: "이 옵션을 활성화하고 모더레이션으로 이동해 버블 타임라인에 표시할 서버를 구성해 주세요."
bubbleInstancesDescription: "버블 타임라인에 표시할 서버의 호스트 이름을 줄바꿈으로 구분하여 설정해요."
Expand Down Expand Up @@ -2112,7 +2114,7 @@ _signup:
_accountDelete:
accountDelete: "계정 삭제"
mayTakeTime: "계정 삭제는 서버에 부하를 가하기 때문에, 작성한 콘텐츠나 업로드한 파일의 수가 많으면 완료까지 시간이 걸릴 수 있어요."
sendEmail: "계정 삭제가 완료되면 등록된 메일 주소로 알림을 보내드려요."
sendEmail: "계정 삭제가 완료되면 등록된 메일 주소로 알림을 보내드릴게요."
requestAccountDelete: "계정 삭제 요청"
started: "삭제 작업이 시작되었어요."
inProgress: "삭제 진행 중"
Expand Down Expand Up @@ -3184,3 +3186,10 @@ _searchSite:
otherDescription: "검색 엔진을 직접 지정할 수 있어요."
query: "검색 쿼리"
queryDescription: "검색 엔진이 사용할 쿼리를 입력해 주세요. (예: https://www.google.com/search?q=test 의 경우 q를 입력)"
_accountTruncate:
accountTruncate: "계정 정리"
mayTakeTime: "계정 정리는 서버에 부하를 가하기 때문에, 작성한 콘텐츠나 업로드한 파일의 수가 많으면 완료까지 시간이 걸릴 수 있어요."
sendEmail: "계정 삭제가 완료되면 등록된 메일 주소로 알림을 보내드릴게요."
requestAccountTruncate: "계정 정리 요청"
started: "정리 작업이 시작되었어요."
inProgress: "정리 진행 중"
6 changes: 6 additions & 0 deletions packages/backend/src/core/CoreModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { CaptchaService } from './CaptchaService.js';
import { CreateSystemUserService } from './CreateSystemUserService.js';
import { CustomEmojiService } from './CustomEmojiService.js';
import { DeleteAccountService } from './DeleteAccountService.js';
import { TruncateAccountService } from './TruncateAccountService.js';
import { DownloadService } from './DownloadService.js';
import { DriveService } from './DriveService.js';
import { EmailService } from './EmailService.js';
Expand Down Expand Up @@ -176,6 +177,7 @@ const $CaptchaService: Provider = { provide: 'CaptchaService', useExisting: Capt
const $CreateSystemUserService: Provider = { provide: 'CreateSystemUserService', useExisting: CreateSystemUserService };
const $CustomEmojiService: Provider = { provide: 'CustomEmojiService', useExisting: CustomEmojiService };
const $DeleteAccountService: Provider = { provide: 'DeleteAccountService', useExisting: DeleteAccountService };
const $TruncateAccountService: Provider = { provide: 'TruncateAccountService', useExisting: TruncateAccountService };
const $DownloadService: Provider = { provide: 'DownloadService', useExisting: DownloadService };
const $DriveService: Provider = { provide: 'DriveService', useExisting: DriveService };
const $EmailService: Provider = { provide: 'EmailService', useExisting: EmailService };
Expand Down Expand Up @@ -333,6 +335,7 @@ const $ApEventService: Provider = { provide: 'ApEventService', useExisting: ApEv
CreateSystemUserService,
CustomEmojiService,
DeleteAccountService,
TruncateAccountService,
DownloadService,
DriveService,
EmailService,
Expand Down Expand Up @@ -486,6 +489,7 @@ const $ApEventService: Provider = { provide: 'ApEventService', useExisting: ApEv
$CreateSystemUserService,
$CustomEmojiService,
$DeleteAccountService,
$TruncateAccountService,
$DownloadService,
$DriveService,
$EmailService,
Expand Down Expand Up @@ -640,6 +644,7 @@ const $ApEventService: Provider = { provide: 'ApEventService', useExisting: ApEv
CreateSystemUserService,
CustomEmojiService,
DeleteAccountService,
TruncateAccountService,
DownloadService,
DriveService,
EmailService,
Expand Down Expand Up @@ -792,6 +797,7 @@ const $ApEventService: Provider = { provide: 'ApEventService', useExisting: ApEv
$CreateSystemUserService,
$CustomEmojiService,
$DeleteAccountService,
$TruncateAccountService,
$DownloadService,
$DriveService,
$EmailService,
Expand Down
10 changes: 10 additions & 0 deletions packages/backend/src/core/QueueService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,16 @@ export class QueueService {
});
}

@bindThis
public createTruncateAccountJob(user: ThinUser) {
return this.dbQueue.add('truncateAccount', {
user: { id: user.id },
}, {
removeOnComplete: true,
removeOnFail: true,
});
}

@bindThis
public createReportAbuseJob(report: MiAbuseUserReport) {
return this.dbQueue.add('reportAbuse', report);
Expand Down
34 changes: 34 additions & 0 deletions packages/backend/src/core/TruncateAccountService.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

import { Inject, Injectable } from '@nestjs/common';
import type { UsersRepository } from '@/models/_.js';
import { QueueService } from '@/core/QueueService.js';
import { DI } from '@/di-symbols.js';
import { bindThis } from '@/decorators.js';

@Injectable()
export class TruncateAccountService {
constructor(
@Inject(DI.usersRepository)
private usersRepository: UsersRepository,

private queueService: QueueService,
) {
}

@bindThis
public async truncateAccount(user: {
id: string;
host: string | null;
}): Promise<void> {
const _user = await this.usersRepository.findOneByOrFail({ id: user.id });

this.queueService.createTruncateAccountJob(user, {
soft: false,
});
}
}

2 changes: 2 additions & 0 deletions packages/backend/src/queue/QueueProcessorModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { CleanChartsProcessorService } from './processors/CleanChartsProcessorSe
import { CleanProcessorService } from './processors/CleanProcessorService.js';
import { CleanRemoteFilesProcessorService } from './processors/CleanRemoteFilesProcessorService.js';
import { DeleteAccountProcessorService } from './processors/DeleteAccountProcessorService.js';
import { TruncateAccountProcessorService } from './processors/TruncateAccountProcessorService.js';
import { DeleteDriveFilesProcessorService } from './processors/DeleteDriveFilesProcessorService.js';
import { DeleteFileProcessorService } from './processors/DeleteFileProcessorService.js';
import { ExportBlockingProcessorService } from './processors/ExportBlockingProcessorService.js';
Expand Down Expand Up @@ -75,6 +76,7 @@ import { ScheduleNotePostProcessorService } from './processors/ScheduleNotePostP
ImportCustomEmojisProcessorService,
ImportAntennasProcessorService,
DeleteAccountProcessorService,
TruncateAccountProcessorService,
DeleteFileProcessorService,
CleanRemoteFilesProcessorService,
RelationshipProcessorService,
Expand Down
3 changes: 3 additions & 0 deletions packages/backend/src/queue/QueueProcessorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { ImportUserListsProcessorService } from './processors/ImportUserListsPro
import { ImportCustomEmojisProcessorService } from './processors/ImportCustomEmojisProcessorService.js';
import { ImportAntennasProcessorService } from './processors/ImportAntennasProcessorService.js';
import { DeleteAccountProcessorService } from './processors/DeleteAccountProcessorService.js';
import { TruncateAccountProcessorService } from './processors/TruncateAccountProcessorService.js';
import { ExportFavoritesProcessorService } from './processors/ExportFavoritesProcessorService.js';
import { CleanRemoteFilesProcessorService } from './processors/CleanRemoteFilesProcessorService.js';
import { DeleteFileProcessorService } from './processors/DeleteFileProcessorService.js';
Expand Down Expand Up @@ -121,6 +122,7 @@ export class QueueProcessorService implements OnApplicationShutdown {
private importCustomEmojisProcessorService: ImportCustomEmojisProcessorService,
private importAntennasProcessorService: ImportAntennasProcessorService,
private deleteAccountProcessorService: DeleteAccountProcessorService,
private truncateAccountProcessorService: TruncateAccountProcessorService,
private deleteFileProcessorService: DeleteFileProcessorService,
private cleanRemoteFilesProcessorService: CleanRemoteFilesProcessorService,
private relationshipProcessorService: RelationshipProcessorService,
Expand Down Expand Up @@ -233,6 +235,7 @@ export class QueueProcessorService implements OnApplicationShutdown {
case 'importCustomEmojis': return this.importCustomEmojisProcessorService.process(job);
case 'importAntennas': return this.importAntennasProcessorService.process(job);
case 'deleteAccount': return this.deleteAccountProcessorService.process(job);
case 'truncateAccount': return this.truncateAccountProcessorService.process(job);
case 'reportAbuse': return this.reportAbuseProcessorService.process(job);
default: throw new Error(`unrecognized job type ${job.name} for db`);
}
Expand Down
Loading

0 comments on commit d04b9c7

Please sign in to comment.