mirror of
https://github.com/PretendoNetwork/account.git
synced 2026-07-16 00:41:28 -05:00
fix: add automatic this.save() calls to pnid.scrub/markForDeletion
This commit is contained in:
parent
eef5b0b4af
commit
f1262bf64a
|
|
@ -264,6 +264,8 @@ PNIDSchema.method('markForDeletion', async function markForDeletion() {
|
|||
LOG_ERROR(`ERROR UPDATING SUBSCRIPTION FOR USER ${this.username} (${subscriptionID}). ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
await this.save();
|
||||
});
|
||||
|
||||
PNIDSchema.method('scrub', async function scrub() {
|
||||
|
|
@ -362,6 +364,8 @@ PNIDSchema.method('scrub', async function scrub() {
|
|||
this.connections.stripe.tier_level = 0;
|
||||
this.connections.stripe.tier_name = '';
|
||||
this.connections.stripe.latest_webhook_timestamp = 0;
|
||||
|
||||
await this.save();
|
||||
});
|
||||
|
||||
PNIDSchema.method('hasPermission', function hasPermission(flag: PNIDPermissionFlag): boolean {
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ export async function deleteAccount(request: DeleteAccountRequest): Promise<Dele
|
|||
await pnid.markForDeletion();
|
||||
}
|
||||
|
||||
await pnid.save();
|
||||
|
||||
await sendPNIDDeletedEmail(email, pnid.username);
|
||||
|
||||
if (request.bypassGracePeriod) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ export async function deleteAccount(request: DeleteAccountRequest): Promise<Dele
|
|||
const email = pnid.email.address;
|
||||
|
||||
await pnid.markForDeletion();
|
||||
await pnid.save();
|
||||
|
||||
await sendPNIDDeletedEmail(email, pnid.username);
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -581,7 +581,6 @@ router.post('/@me/deletion', async (request: express.Request, response: express.
|
|||
const email = pnid.email.address;
|
||||
|
||||
await pnid.markForDeletion();
|
||||
await pnid.save();
|
||||
|
||||
try {
|
||||
await sendPNIDDeletedEmail(email, pnid.username);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user