[Chore]: Reload inbox when receiving onDelete signal

This commit is contained in:
ClaraCrazy 2025-12-31 20:43:19 +01:00
parent 240f7feb42
commit 96978c4ea2
No known key found for this signature in database
GPG key ID: EBBC896ACB497011

View file

@ -169,7 +169,24 @@ class MailProcessingService extends EventEmitter {
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)
// Notify affected inboxes to reload
if (this.initialLoadDone) {
affectedAddresses.forEach(address => {
debug('Notifying inbox after deletion:', address)
this.clientNotification.emit(address)
})
}
}
async _deleteOldMails() {