discourse/app
Régis Hanol 5f6b6e9818 FIX: correctly compute the window for email summaries
In 958437e7dd we ensured that the email summaries are properly sent based on 'digest_attempted_at' for people who barely/never visit the forum.

This fixed the "frequency" of the email summaries but introduced a bug where the digest would be sent even though there wasn't anything new since for some users.

The logic we use to compute the threshold date for the content to be included in the digest was

```ruby
@since = opts[:since] || user.last_seen_at || user.user_stat&.digest_attempted_at || 1.month.ago
```

It was working as expected for users who haven never been seen but for users who have connected at least once, we would use their "last_seen_at" date as the "threshold date" for the content to be sent in a summary 😬

This fix changes the logic to be the most recent date amongst the `last_seen_at`, `digest_attempted_at` and `1.month.ago` so it's correctly handling cases where

- user has never been seen nor emailed a summary
- user has been seen in a while but has recently been sent a summary
- user has been sent a summary recently but hasn't been seen in a while.
2024-05-27 22:33:51 +02:00
..
assets DEV: linting (#27205) 2024-05-27 16:35:30 +02:00
controllers DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
helpers DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
jobs DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
mailers FIX: correctly compute the window for email summaries 2024-05-27 22:33:51 +02:00
models DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
serializers DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
services DEV: Update to lastest rubocop-discourse 2024-05-27 18:06:14 +02:00
views FIX: send activity summaries based on "last seen" (#27035) 2024-05-22 10:23:03 +02:00