Improve e-mail digest (#9689)

- Reduce time-to-digest from 20 to 7 days
- Fetch mentions starting from +1 day since last login
- Fix case when last login is more recent than last e-mail
- Do not render all mentions, only 40, but show number in subject
- Do not send digest to moved accounts
- Do send digest to silenced accounts
This commit is contained in:
Eugen Rochko 2019-01-02 10:47:32 +01:00 committed by GitHub
parent dc84899fff
commit 66436d0895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 30 deletions

View file

@ -126,19 +126,7 @@ RSpec.describe NotificationMailer, type: :mailer do
end
end
it 'includes activities since the date specified by :since option' do
receiver.update!(last_emailed_at: '2000-02-01T00:00:00Z', current_sign_in_at: '2000-03-01T00:00:00Z')
mail = NotificationMailer.digest(receiver.account, since: Time.parse('2000-01-01T00:00:00Z'))
expect(mail.body.encoded).to include 'Jan 01, 2000, 00:00'
end
it 'includes activities since the receiver was last emailed if :since option is unavailable' do
receiver.update!(last_emailed_at: '2000-02-01T00:00:00Z', current_sign_in_at: '2000-03-01T00:00:00Z')
mail = NotificationMailer.digest(receiver.account)
expect(mail.body.encoded).to include 'Feb 01, 2000, 00:00'
end
it 'includes activities since the receiver last signed in if :since option and the last emailed date are unavailable' do
it 'includes activities since the receiver last signed in' do
receiver.update!(last_emailed_at: nil, current_sign_in_at: '2000-03-01T00:00:00Z')
mail = NotificationMailer.digest(receiver.account)
expect(mail.body.encoded).to include 'Mar 01, 2000, 00:00'