mirror of
https://github.com/Crazyco-xyz/48hr.email.git
synced 2025-12-16 14:56:31 +01:00
Update non-example mail handling to delete rather than ignore
This commit is contained in:
parent
08c41fbf09
commit
9e6f09077d
1 changed files with 13 additions and 3 deletions
|
|
@ -12,12 +12,22 @@ class MailRepository {
|
|||
|
||||
getForRecipient(address) {
|
||||
let mails = this.mailSummaries.get(address) || []
|
||||
const mailsToDelete = []
|
||||
|
||||
mails.forEach(mail => {
|
||||
if (mail.to == this.config.email.examples.account && !this.config.email.examples.uids.includes(parseInt(mail.uid))) {
|
||||
mails = mails.filter(m => m.uid != mail.uid)
|
||||
debug('Prevented non-example email from being shown in example inbox', mail.uid)
|
||||
mailsToDelete.push(mail.uid)
|
||||
debug('Marking non-example email for deletion from example inbox', mail.uid)
|
||||
}
|
||||
})
|
||||
|
||||
// Delete the non-example mails
|
||||
mailsToDelete.forEach(uid => {
|
||||
this.removeUid(uid, address)
|
||||
})
|
||||
|
||||
// Get fresh list after deletions
|
||||
mails = this.mailSummaries.get(address) || []
|
||||
return _.orderBy(mails, mail => Date.parse(mail.date), ['desc'])
|
||||
}
|
||||
|
||||
|
|
@ -57,4 +67,4 @@ class MailRepository {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MailRepository
|
||||
module.exports = MailRepository
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue