Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

feat: GDPR Data export for users #143

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2401,3 +2401,9 @@ _animatedMFM:
_alert:
text: "Animated MFMs could include flashing lights and fast moving text/emojis."
confirm: "Animate"

_dataRequest:
title: "Request Data"
warn: "Data requests are only possible every 3 days."
text: "Once the data is ready to download, an email will be sent to the email address registered to this account."
button: "Request"
6 changes: 6 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2509,6 +2509,12 @@ export interface Locale {
"confirm": string;
};
};
"_dataRequest": {
"title": string;
"warn": string;
"text": string;
"button": string;
};
}
declare const locales: {
[lang: string]: Locale;
Expand Down
6 changes: 6 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2395,3 +2395,9 @@ _animatedMFM:
_alert:
text: "アニメーションMFMには、点滅するライトや高速で動くテキスト/絵文字を含めることができる。"
confirm: "アニメイト"

_dataRequest:
title: "リクエストデータ"
warn: "データのリクエストは3日ごとにしかできない。"
text: "データのダウンロードが完了すると、このアカウントに登録されているEメールアドレスにEメールが送信されます。"
button: "リクエスト"
10 changes: 10 additions & 0 deletions packages/backend/src/core/QueueService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,16 @@ export class QueueService {
});
}

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

@bindThis
public createExportNotesJob(user: ThinUser) {
return this.dbQueue.add('exportNotes', {
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/queue/QueueProcessorModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CleanRemoteFilesProcessorService } from './processors/CleanRemoteFilesP
import { DeleteAccountProcessorService } from './processors/DeleteAccountProcessorService.js';
import { DeleteDriveFilesProcessorService } from './processors/DeleteDriveFilesProcessorService.js';
import { DeleteFileProcessorService } from './processors/DeleteFileProcessorService.js';
import { ExportAccountDataProcessorService } from './processors/ExportAccountDataProcessorService.js';
import { ExportBlockingProcessorService } from './processors/ExportBlockingProcessorService.js';
import { ExportCustomEmojisProcessorService } from './processors/ExportCustomEmojisProcessorService.js';
import { ExportFollowingProcessorService } from './processors/ExportFollowingProcessorService.js';
Expand Down Expand Up @@ -51,6 +52,7 @@ import { RelationshipProcessorService } from './processors/RelationshipProcessor
CheckExpiredMutingsProcessorService,
CleanProcessorService,
DeleteDriveFilesProcessorService,
ExportAccountDataProcessorService,
ExportCustomEmojisProcessorService,
ExportNotesProcessorService,
ExportFavoritesProcessorService,
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 @@ -14,6 +14,7 @@ import { EndedPollNotificationProcessorService } from './processors/EndedPollNot
import { DeliverProcessorService } from './processors/DeliverProcessorService.js';
import { InboxProcessorService } from './processors/InboxProcessorService.js';
import { DeleteDriveFilesProcessorService } from './processors/DeleteDriveFilesProcessorService.js';
import { ExportAccountDataProcessorService } from './processors/ExportAccountDataProcessorService.js';
import { ExportCustomEmojisProcessorService } from './processors/ExportCustomEmojisProcessorService.js';
import { ExportNotesProcessorService } from './processors/ExportNotesProcessorService.js';
import { ExportFollowingProcessorService } from './processors/ExportFollowingProcessorService.js';
Expand Down Expand Up @@ -89,6 +90,7 @@ export class QueueProcessorService implements OnApplicationShutdown {
private deliverProcessorService: DeliverProcessorService,
private inboxProcessorService: InboxProcessorService,
private deleteDriveFilesProcessorService: DeleteDriveFilesProcessorService,
private exportAccountDataProcessorService: ExportAccountDataProcessorService,
private exportCustomEmojisProcessorService: ExportCustomEmojisProcessorService,
private exportNotesProcessorService: ExportNotesProcessorService,
private exportFavoritesProcessorService: ExportFavoritesProcessorService,
Expand Down Expand Up @@ -162,6 +164,7 @@ export class QueueProcessorService implements OnApplicationShutdown {
this.dbQueueWorker = new Bull.Worker(QUEUE.DB, (job) => {
switch (job.name) {
case 'deleteDriveFiles': return this.deleteDriveFilesProcessorService.process(job);
case 'exportAccountData': return this.exportAccountDataProcessorService.process(job);
case 'exportCustomEmojis': return this.exportCustomEmojisProcessorService.process(job);
case 'exportNotes': return this.exportNotesProcessorService.process(job);
case 'exportFavorites': return this.exportFavoritesProcessorService.process(job);
Expand Down
Loading
Loading