mirror of
https://github.com/Crazyco-xyz/48hr.email.git
synced 2026-01-10 03:29:36 +01:00
[Chore]: Reload inbox when receiving onDelete signal
This commit is contained in:
parent
240f7feb42
commit
96978c4ea2
1 changed files with 17 additions and 0 deletions
|
|
@ -169,7 +169,24 @@ class MailProcessingService extends EventEmitter {
|
||||||
debug('Failed to clear email cache:', err.message)
|
debug('Failed to clear email cache:', err.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find which addresses have this UID before removing it
|
||||||
|
const affectedAddresses = []
|
||||||
|
this.mailRepository.mailSummaries.forEachAssociation((mails, address) => {
|
||||||
|
if (mails.some(mail => mail.uid === parseInt(uid))) {
|
||||||
|
affectedAddresses.push(address)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// Remove from repository
|
||||||
this.mailRepository.removeUid(uid)
|
this.mailRepository.removeUid(uid)
|
||||||
|
|
||||||
|
// Notify affected inboxes to reload
|
||||||
|
if (this.initialLoadDone) {
|
||||||
|
affectedAddresses.forEach(address => {
|
||||||
|
debug('Notifying inbox after deletion:', address)
|
||||||
|
this.clientNotification.emit(address)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _deleteOldMails() {
|
async _deleteOldMails() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue