Skip to content

Commit

Permalink
impr(server): remove discord roles on account reset
Browse files Browse the repository at this point in the history
closes #4730
  • Loading branch information
Miodec committed Oct 20, 2023
1 parent 8897adc commit d5c8f0d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backend/src/api/controllers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ export async function resetUser(
const { uid } = req.ctx.decodedToken;

const userInfo = await UserDAL.getUser(uid, "reset user");
await Promise.all([
const promises = [
UserDAL.resetUser(uid),
deleteAllApeKeys(uid),
deleteAllPresets(uid),
Expand All @@ -204,7 +204,12 @@ export async function resetUser(
uid,
req.ctx.configuration.dailyLeaderboards
),
]);
];

if (userInfo.discordId) {
promises.push(GeorgeQueue.unlinkDiscord(userInfo.discordId, uid));
}
await Promise.all(promises);
Logger.logToDb("user_reset", `${userInfo.email} ${userInfo.name}`, uid);

return new MonkeyResponse("User reset");
Expand Down

0 comments on commit d5c8f0d

Please sign in to comment.