Fix notification deduplication to prevent pile-up in navbar (#945)

* Fix notification deduplication to prevent pile-up in navbar (#944)

When tasks/projects remained pending for multiple days, duplicate
notifications accumulated in the navbar instead of showing only the
most recent one.

Updated notification services to properly handle existing notifications:
- Delete unread notifications before creating new ones
- Respect dismissed notifications (don't recreate)
- Respect read notifications (don't duplicate)

Changes:
- Updated dueTaskService, deferredTaskService, and dueProjectService
- Added comprehensive unit tests with 8 test cases

Fixes #944

* Fix lint errors and add GitHub bug template reminder to docs
This commit is contained in:
Chris 2026-03-14 19:45:24 +02:00 committed by GitHub
parent 1d5de49b48
commit 105a913a8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 355 additions and 11 deletions

View file

@ -68,7 +68,19 @@ async function checkDeferredTasks() {
);
if (existingNotification) {
continue;
// If notification was dismissed, don't create it again
if (existingNotification.dismissed_at) {
continue;
}
// If notification is unread, delete it before creating the new one
// This prevents duplicate notifications from piling up
if (!existingNotification.read_at) {
await existingNotification.destroy();
} else {
// If it was already read, skip creating a new one
continue;
}
}
const sources = [];