Pages corrections widget
This commit is contained in:
parent
ed9dadd77a
commit
b6bb7b61ad
@ -228,32 +228,30 @@ export function Email() {
|
|||||||
items: notificationItems,
|
items: notificationItems,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Dispatch event for Outlook-style notifications (for new emails detected by ID)
|
// Dispatch event for Outlook-style notifications (for new emails detected by ID)
|
||||||
if (hasNewEmails) {
|
if (hasNewEmails) {
|
||||||
// Get only the newly arrived emails (by ID comparison)
|
// Get only the newly arrived emails (by ID comparison)
|
||||||
const newEmails = transformedEmails
|
const newEmails = transformedEmails
|
||||||
.filter(e => newEmailIds.has(e.id) && !e.read)
|
.filter(e => newEmailIds.has(e.id) && !e.read)
|
||||||
.slice(0, 5); // Limit to 5 most recent new emails
|
.slice(0, 5); // Limit to 5 most recent new emails
|
||||||
|
|
||||||
if (newEmails.length > 0) {
|
if (newEmails.length > 0) {
|
||||||
console.log('[Email Widget] 📧 Dispatching new emails event', {
|
console.log('[Email Widget] 📧 Dispatching new emails event', {
|
||||||
newEmailsCount: newEmails.length,
|
newEmailsCount: newEmails.length,
|
||||||
newEmailIds: Array.from(newEmailIds),
|
newEmailIds: Array.from(newEmailIds),
|
||||||
previousCount,
|
previousCount: lastUnreadCountRef.current,
|
||||||
currentCount: currentUnreadCount,
|
currentCount: currentUnreadCount,
|
||||||
previousEmailIds: Array.from(lastEmailIdsRef.current),
|
previousEmailIds: Array.from(lastEmailIdsRef.current),
|
||||||
});
|
});
|
||||||
|
|
||||||
window.dispatchEvent(new CustomEvent('new-emails-detected', {
|
window.dispatchEvent(new CustomEvent('new-emails-detected', {
|
||||||
detail: {
|
detail: {
|
||||||
emails: transformedEmails,
|
emails: transformedEmails,
|
||||||
accountMap: accountMap,
|
accountMap: accountMap,
|
||||||
previousCount,
|
previousCount: lastUnreadCountRef.current,
|
||||||
currentCount: currentUnreadCount,
|
currentCount: currentUnreadCount,
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user