FEATURE: add more granular user option levels for email notifications (#7143)

Migrates email user options to a new data structure, where `email_always`, `email_direct` and `email_private_messages` are replace by

* `email_messages_level`, with options: `always`, `only_when_away` and `never` (defaults to `always`)
* `email_level`, with options: `always`, `only_when_away` and `never` (defaults to `only_when_away`)
This commit is contained in:
Penar Musaraj
2019-03-15 10:55:11 -04:00
committed by GitHub
parent 93490fbfaf
commit 9334d2f4f7
37 changed files with 334 additions and 118 deletions

View File

@@ -73,7 +73,7 @@ describe Jobs::EnqueueDigestEmails do
context 'visited the site this week' do
let(:user_visited_this_week) { Fabricate(:active_user, last_seen_at: 6.days.ago) }
let(:user_visited_this_week_email_always) { Fabricate(:active_user, last_seen_at: 6.days.ago, email_always: true) }
let(:user_visited_this_week_email_always) { Fabricate(:active_user, last_seen_at: 6.days.ago, email_level: UserOption.email_level_types[:always]) }
it "doesn't return users who have been emailed recently" do
user = user_visited_this_week