mirror of
https://github.com/Crazyco-xyz/48hr.email.git
synced 2026-01-09 03:09:36 +01:00
[Fix]: Fix wipe inbox button
This commit is contained in:
parent
fd993eb272
commit
68dda6880a
1 changed files with 10 additions and 3 deletions
|
|
@ -161,10 +161,17 @@ router.get(
|
|||
const mailProcessingService = req.app.get('mailProcessingService')
|
||||
debug(`Deleting all emails for ${req.params.address}`)
|
||||
const mailSummaries = await mailProcessingService.getMailSummaries(req.params.address)
|
||||
for (mail in mailSummaries) {
|
||||
await mailProcessingService.deleteSpecificEmail(req.params.address, mailSummaries[mail].uid)
|
||||
// Create a copy of the array to avoid modification during iteration
|
||||
const summariesToDelete = [...mailSummaries]
|
||||
|
||||
let deletedCount = 0
|
||||
for (const mail of summariesToDelete) {
|
||||
await mailProcessingService.deleteSpecificEmail(req.params.address, mail.uid)
|
||||
deletedCount++
|
||||
debug(`Successfully deleted UID ${mail.uid}`)
|
||||
}
|
||||
debug(`Deleted all emails for ${req.params.address}`)
|
||||
|
||||
debug(`Deleted all ${deletedCount} emails for ${req.params.address}`)
|
||||
res.redirect(`/inbox/${req.params.address}`)
|
||||
} catch (error) {
|
||||
debug(`Error deleting all emails for ${req.params.address}:`, error.message)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue