Description
Tududi has a partially implemented email notification system that needs to be completed and enabled. The infrastructure (email service, notification model, user preferences) exists but is disabled in the UI and lacks the scheduled notification jobs to trigger emails.
Current State
Already Implemented:
- Email service with nodemailer (
backend/services/emailService.js)
- Notification model with email channel support (
backend/models/notification.js)
- User notification preferences UI with email toggles (disabled)
- Email sending when notifications are created with
sources.includes('email')
Not Yet Working:
- Email toggles are disabled in the UI (marked as "Coming Soon")
- No scheduled cron jobs to generate notifications
- User preferences for email are not respected in notification creation
Expected Behavior
Users should be able to:
- Enable/disable email notifications for different notification types in Profile > Notifications
- Receive email notifications based on their preferences for:
- Due Tasks: Tasks due within 24 hours
- Overdue Tasks: Tasks that have passed their due date
- Defer Until: Tasks that are now available to work on
- Due Projects: Projects due within 24 hours
- Overdue Projects: Projects that have passed their due date
Implementation Requirements
1. Enable Email in UI
- Remove "Coming Soon" label from email column in NotificationsTab
- Change email toggle availability from
false to true in frontend/components/Profile/tabs/NotificationsTab.tsx
- Add email configuration check (similar to Telegram check)
2. Create Notification Scheduler Service
Create backend/services/notificationScheduler.js with cron jobs for:
- Due soon checks (run hourly): Find tasks/projects due in next 24h
- Overdue checks (run daily at 6 AM): Find overdue tasks/projects
- Defer until checks (run every 15 min): Find tasks that just became available
3. Respect User Preferences
When creating notifications, check user's notification preferences:
- Load user's
notification_preferences from profile
- Only add 'email' to
sources array if user has enabled email for that notification type
- Update notification creation logic to check preferences before sending
4. Email Templates
Create HTML email templates for better formatting:
- Task due soon template
- Task overdue template
- Project due soon template
- Project overdue template
- Defer until available template
5. Email Configuration Validation
Add UI to check email configuration status:
- Show warning if email is enabled but SMTP not configured
- Add test email button (similar to test notification)
6. Testing
- Unit tests for notification scheduler
- Integration tests for email sending with preferences
- E2E tests for enabling/disabling email notifications
Technical Files to Modify
Frontend:
frontend/components/Profile/tabs/NotificationsTab.tsx - Enable email toggles
frontend/components/Profile/tabs/types.ts - Type definitions (if needed)
Backend:
backend/services/notificationScheduler.js - NEW: Create scheduler service
backend/services/emailTemplates.js - NEW: Email HTML templates
backend/models/notification.js - Update to check user preferences
backend/server.js - Initialize notification scheduler on startup
Testing:
backend/tests/services/notificationScheduler.test.js - NEW
backend/tests/services/emailService.test.js - Expand existing tests
Environment Variables Required
Users will need to configure (already documented):
EMAIL_ENABLED=true
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-email@example.com
SMTP_PASS=your-password
EMAIL_FROM_ADDRESS=noreply@tududi.com
EMAIL_FROM_NAME=Tududi Notifications
Acceptance Criteria
Additional Context
This is a high-priority feature for v1.1.0 as it completes the notification system alongside the existing in-app and Telegram notifications. The foundation is already in place, so this is primarily about enabling and integrating existing components with the new scheduler.
Operating System
All (server-side feature)
Browser
All
Version
v1.0.0-rc.3 (targeting v1.1.0)
Description
Tududi has a partially implemented email notification system that needs to be completed and enabled. The infrastructure (email service, notification model, user preferences) exists but is disabled in the UI and lacks the scheduled notification jobs to trigger emails.
Current State
Already Implemented:
backend/services/emailService.js)backend/models/notification.js)sources.includes('email')Not Yet Working:
Expected Behavior
Users should be able to:
Implementation Requirements
1. Enable Email in UI
falsetotrueinfrontend/components/Profile/tabs/NotificationsTab.tsx2. Create Notification Scheduler Service
Create
backend/services/notificationScheduler.jswith cron jobs for:3. Respect User Preferences
When creating notifications, check user's notification preferences:
notification_preferencesfrom profilesourcesarray if user has enabled email for that notification type4. Email Templates
Create HTML email templates for better formatting:
5. Email Configuration Validation
Add UI to check email configuration status:
6. Testing
Technical Files to Modify
Frontend:
frontend/components/Profile/tabs/NotificationsTab.tsx- Enable email togglesfrontend/components/Profile/tabs/types.ts- Type definitions (if needed)Backend:
backend/services/notificationScheduler.js- NEW: Create scheduler servicebackend/services/emailTemplates.js- NEW: Email HTML templatesbackend/models/notification.js- Update to check user preferencesbackend/server.js- Initialize notification scheduler on startupTesting:
backend/tests/services/notificationScheduler.test.js- NEWbackend/tests/services/emailService.test.js- Expand existing testsEnvironment Variables Required
Users will need to configure (already documented):
Acceptance Criteria
Additional Context
This is a high-priority feature for v1.1.0 as it completes the notification system alongside the existing in-app and Telegram notifications. The foundation is already in place, so this is primarily about enabling and integrating existing components with the new scheduler.
Operating System
All (server-side feature)
Browser
All
Version
v1.0.0-rc.3 (targeting v1.1.0)