mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
committed by
Régis Hanol
parent
4eeae880b6
commit
feffe23cc5
17
spec/models/mailing_list_mode_site_setting_spec.rb
Normal file
17
spec/models/mailing_list_mode_site_setting_spec.rb
Normal 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
|
||||
@@ -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) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user