Files
hermes-config/skills/self-hosting/shop-pro-quote/references/task-notifications.md
T
2026-07-12 10:17:17 -04:00

40 lines
1.7 KiB
Markdown

# Task Desktop Notifications
Added June 2026 to `dashboard.js`. Tasks now fire browser desktop notifications when overdue or due within 1 hour.
## Architecture
The `checkForTaskAlerts()` function runs on every dashboard refresh tick (configurable, default 30s) alongside existing `checkForNewCriticalAlerts()` and `checkForApproachingPromised()`.
```
tick() → loadDashboardData() → checkForNewCriticalAlerts() → checkForApproachingPromised() → checkForTaskAlerts()
```
## Notification types
| Alert | Trigger | Title | Body format |
|---|---|---|---|
| Overdue | Task past due, not completed, newly detected | "🔴 Task Overdue" | "[title] — was due [Xh Ym / Xm] ago" |
| Upcoming | Task due within 1 hour, not completed, newly detected | "⏰ Task Due Soon" | "[title] — due in [<1 min / Xm]" |
## Deduplication
New alerts are only sent for tasks NOT in the last-known set:
- `lastOverdueTaskIds` — Set of overdue task IDs (resets each tick)
- `lastUpcomingTaskIds` — Set of upcoming task IDs (resets each tick)
A task that's overdue on tick 1 fires once. On tick 2, it's already in the set and won't fire again. If the task is completed, it falls out of both filters.
## Respects settings
Uses the same `window.appSettings.desktopNotifications` toggle as RO overdue alerts. If desktop notifications are disabled in Site Configuration, task alerts are muted too.
## Browser API
Uses the existing `showDesktopNotification()` helper which wraps `Notification` API. First use prompts for permission. Once granted, notifications appear as OS-level toasts across all tabs/apps.
## Code location
- `dashboard.js`: `checkForTaskAlerts()` function (~line 2011), `tick()` at line 205
- `dashboard.js`: `showDesktopNotification()` helper at line 2054