Skip to content

Commit

Permalink
Improve deleteAccount functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
StamTsag committed Feb 28, 2024
1 parent f469fb9 commit a092af9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/events/account/deleteAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,26 @@ async function deleteAccount({

deleteImage(message.attachment);
}

// Channel messages too
const deletedMessagesChannels =
await prismaClient.channelMessage.findMany({
where: {
ownerId: account.profileId,
},
});

await prismaClient.channelMessage.deleteMany({
where: {
ownerId: account.profileId,
},
});

for (const messageIndex in deletedMessagesChannels) {
const message = deletedMessagesChannels[messageIndex];

deleteImage(message.attachment);
}
}

async function deleteServers(): Promise<void> {
Expand Down

0 comments on commit a092af9

Please sign in to comment.