tududi/backend/modules
Chris 11cd77bedd
Fix Telegram notification spam with channel-level rate limiting (#951)
* Fix Telegram notification spam with channel-level rate limiting

Addresses issue #950 where Telegram notifications were sent excessively
(96-288 messages per day per task) due to the delete-and-recreate pattern
added in commit 105a913a to fix navbar notification pile-up.

Changes:
- Add channel_sent_at JSON field to notifications table to track when
  each channel (telegram, email, push) was last sent
- Add helper methods to notification model:
  - markChannelAsSent(channel): Records send timestamp
  - wasChannelRecentlySent(channel, threshold): Checks if sent within 24h
- Modify sendTelegramNotification() to check rate limit before sending
- Update service layer (dueTaskService, deferredTaskService,
  dueProjectService) to preserve channel_sent_at when recreating
  notifications
- Add comprehensive unit and integration tests (20 tests, all passing)

Impact:
- Reduces Telegram notifications from 96-288/day to 1/day per item
- Preserves in-app notification refresh behavior (every 5-15 min)
- Maintains navbar pile-up fix from original commit
- Rate limit configurable (default: 24 hours)

Fixes #950

* Fix linting and formatting issues

* Fix integration test that was trying to access private function

* Fix prettier formatting in integration test
2026-03-19 20:26:11 +02:00
..
admin Fix admin password update silently failing due to Sequelize VIRTUAL field (#893) 2026-03-03 15:44:41 +02:00
areas Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
auth Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
backup Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
feature-flags Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
habits Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
inbox Add URL detection to inbox processing service (#942) 2026-03-14 08:43:41 +02:00
notes Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
notifications Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
projects Fix Telegram notification spam with channel-level rate limiting (#951) 2026-03-19 20:26:11 +02:00
quotes Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
search Show original task names for recurring tasks in search results (#914) (#915) 2026-03-06 08:57:10 +02:00
shares Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
tags Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
tasks Fix Telegram notification spam with channel-level rate limiting (#951) 2026-03-19 20:26:11 +02:00
telegram Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
url Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00
users Fix isEmail validation failure on valid emails during Docker setup (#835) 2026-02-11 15:42:11 +02:00
views Fix bug 366 (#764) 2026-01-07 18:18:07 +02:00