summaryrefslogtreecommitdiff
path: root/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/queue/processors/DeleteAccountProcessorService.ts')
-rw-r--r--packages/backend/src/queue/processors/DeleteAccountProcessorService.ts38
1 files changed, 28 insertions, 10 deletions
diff --git a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
index 4e9779a41b..5bf64e4f04 100644
--- a/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
+++ b/packages/backend/src/queue/processors/DeleteAccountProcessorService.ts
@@ -18,6 +18,7 @@ import { SearchService } from '@/core/SearchService.js';
import { ApLogService } from '@/core/ApLogService.js';
import { ReactionService } from '@/core/ReactionService.js';
import { QueueService } from '@/core/QueueService.js';
+import { CacheService } from '@/core/CacheService.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
import type { DbUserDeleteJobData } from '../types.js';
@@ -94,6 +95,7 @@ export class DeleteAccountProcessorService {
private searchService: SearchService,
private reactionService: ReactionService,
private readonly apLogService: ApLogService,
+ private readonly cacheService: CacheService,
) {
this.logger = this.queueLoggerService.logger.createSubLogger('delete-account');
}
@@ -128,7 +130,7 @@ export class DeleteAccountProcessorService {
userId: user.id,
});
- this.logger.succ('All clips have been deleted.');
+ this.logger.info('All clips have been deleted.');
}
{ // Delete favorites
@@ -136,10 +138,26 @@ export class DeleteAccountProcessorService {
userId: user.id,
});
- this.logger.succ('All favorites have been deleted.');
+ this.logger.info('All favorites have been deleted.');
}
{ // Delete user relations
+ await this.cacheService.refreshFollowRelationsFor(user.id);
+ await this.cacheService.userFollowingsCache.delete(user.id);
+ await this.cacheService.userFollowingsCache.delete(user.id);
+ await this.cacheService.userBlockingCache.delete(user.id);
+ await this.cacheService.userBlockedCache.delete(user.id);
+ await this.cacheService.userMutingsCache.delete(user.id);
+ await this.cacheService.userMutingsCache.delete(user.id);
+ await this.cacheService.hibernatedUserCache.delete(user.id);
+ await this.cacheService.renoteMutingsCache.delete(user.id);
+ await this.cacheService.userProfileCache.delete(user.id);
+ this.cacheService.userByIdCache.delete(user.id);
+ this.cacheService.localUserByIdCache.delete(user.id);
+ if (user.token) {
+ this.cacheService.localUserByNativeTokenCache.delete(user.token);
+ }
+
await this.followingsRepository.delete({
followerId: user.id,
});
@@ -172,7 +190,7 @@ export class DeleteAccountProcessorService {
muteeId: user.id,
});
- this.logger.succ('All user relations have been deleted.');
+ this.logger.info('All user relations have been deleted.');
}
{ // Delete reactions
@@ -206,7 +224,7 @@ export class DeleteAccountProcessorService {
}
}
- this.logger.succ('All reactions have been deleted');
+ this.logger.info('All reactions have been deleted');
}
{ // Poll votes
@@ -238,7 +256,7 @@ export class DeleteAccountProcessorService {
});
}
- this.logger.succ('All poll votes have been deleted');
+ this.logger.info('All poll votes have been deleted');
}
{ // Delete scheduled notes
@@ -254,7 +272,7 @@ export class DeleteAccountProcessorService {
userId: user.id,
});
- this.logger.succ('All scheduled notes deleted');
+ this.logger.info('All scheduled notes deleted');
}
{ // Delete notes
@@ -312,7 +330,7 @@ export class DeleteAccountProcessorService {
}
}
- this.logger.succ('All of notes deleted');
+ this.logger.info('All of notes deleted');
}
{ // Delete files
@@ -341,7 +359,7 @@ export class DeleteAccountProcessorService {
}
}
- this.logger.succ('All of files deleted');
+ this.logger.info('All of files deleted');
}
{ // Delete actor logs
@@ -353,7 +371,7 @@ export class DeleteAccountProcessorService {
await this.apLogService.deleteInboxLogs(user.id)
.catch(err => this.logger.error(err, `Failed to delete AP logs for user '${user.uri}'`));
- this.logger.succ('All AP logs deleted');
+ this.logger.info('All AP logs deleted');
}
// Do this BEFORE deleting the account!
@@ -379,7 +397,7 @@ export class DeleteAccountProcessorService {
await this.usersRepository.delete(user.id);
}
- this.logger.succ('Account data deleted');
+ this.logger.info('Account data deleted');
}
{ // Send email notification