mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-08 04:54:32 +00:00
don't sent account deletion notice until after it actually completes
This commit is contained in:
parent
7cf293de94
commit
fdf67f6fc7
1 changed files with 29 additions and 11 deletions
|
@ -353,20 +353,38 @@ export class DeleteAccountProcessorService {
|
||||||
this.logger.succ('All AP logs deleted');
|
this.logger.succ('All AP logs deleted');
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Send email notification
|
// Do this BEFORE deleting the account!
|
||||||
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
const profile = await this.userProfilesRepository.findOneByOrFail({ userId: user.id });
|
||||||
if (profile.email && profile.emailVerified) {
|
|
||||||
this.emailService.sendEmail(profile.email, 'Account deleted',
|
{ // Delete the actual account
|
||||||
'Your account has been deleted.',
|
await this.userIpsRepository.delete({
|
||||||
'Your account has been deleted.');
|
userId: user.id,
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
await this.signinsRepository.delete({
|
||||||
|
userId: user.id,
|
||||||
|
});
|
||||||
|
|
||||||
// soft指定されている場合は物理削除しない
|
// soft指定されている場合は物理削除しない
|
||||||
if (job.data.soft) {
|
if (job.data.soft) {
|
||||||
// nop
|
// nop
|
||||||
} else {
|
} else {
|
||||||
await this.usersRepository.delete(job.data.user.id);
|
await this.usersRepository.delete(user.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.logger.succ('Account data deleted');
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // Send email notification
|
||||||
|
if (profile.email && profile.emailVerified) {
|
||||||
|
try {
|
||||||
|
await this.emailService.sendEmail(profile.email, 'Account deleted',
|
||||||
|
'Your account has been deleted.',
|
||||||
|
'Your account has been deleted.');
|
||||||
|
} catch (e) {
|
||||||
|
this.logger.warn('Failed to send account deletion message:', { e });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'Account deleted';
|
return 'Account deleted';
|
||||||
|
|
Loading…
Add table
Reference in a new issue