FEATURE: More granular mailing list mode (#4068)

* Rearrange frontend to account for mailing list mode

* Allow update of user preference for mailing list frequency

* Add mailing list frequency estimate

* Simplify frequency estimate; disable activity summary for mailing list mode

* Remove combined updates

* Add specs for enqueue mailing list mode job

* Write mailing list method for mailer

* Fix linting error

* Account for stale topics

* Add translations for default mailing list setting

* One query for mailing list topics

* Fix failing spec

* WIP

* Flesh out html template

* First pass at text-based mailing list summary

* Add user avatar

* Properly format posts for mailing list

* Move make_all_links_absolute into Email::Styles

* Apply first_seen_at to user

* Send mailing list email summary hourly based on first_seen_at

* Branch and test cleanup

* Use existing mailing list mode estimate

* Fix failing specs
This commit is contained in:
James Kiesel
2016-05-21 06:17:54 -07:00
committed by Régis Hanol
parent 4eeae880b6
commit feffe23cc5
28 changed files with 567 additions and 79 deletions

View File

@@ -0,0 +1,17 @@
require 'rails_helper'
describe MailingListModeSiteSetting do
describe 'valid_value?' do
it 'returns true for a valid value as an int' do
expect(DigestEmailSiteSetting.valid_value?(0)).to eq true
end
it 'returns false for a valid value as a string' do
expect(DigestEmailSiteSetting.valid_value?('0')).to eq true
end
it 'returns false for an out of range value' do
expect(DigestEmailSiteSetting.valid_value?(3)).to eq false
end
end
end

View File

@@ -596,6 +596,29 @@ describe User do
end
describe "update_last_seen!" do
let (:user) { Fabricate(:user) }
let!(:first_visit_date) { Time.zone.now }
let!(:second_visit_date) { 2.hours.from_now }
it "should update the last seen value" do
expect(user.last_seen_at).to eq nil
user.update_last_seen!(first_visit_date)
expect(user.reload.last_seen_at).to be_within_one_second_of(first_visit_date)
end
it "should update the first seen value if it doesn't exist" do
user.update_last_seen!(first_visit_date)
expect(user.reload.first_seen_at).to be_within_one_second_of(first_visit_date)
end
it "should not update the first seen value if it doesn't exist" do
user.update_last_seen!(first_visit_date)
user.update_last_seen!(second_visit_date)
expect(user.reload.first_seen_at).to be_within_one_second_of(first_visit_date)
end
end
describe "last_seen_at" do
let(:user) { Fabricate(:user) }