Revert "added a podwide email preference"

This reverts commit 60c0a9839b.
This commit is contained in:
Ilya Zhitomirskiy 2011-05-18 10:22:20 -07:00
parent d3fe903622
commit 6cda0bf9ea
5 changed files with 3 additions and 25 deletions

View file

@ -7,10 +7,8 @@ class Notifier < ActionMailer::Base
def self.admin(string, recipients, opts = {}) def self.admin(string, recipients, opts = {})
mails = [] mails = []
recipients.each do |rec| recipients.each do |rec|
if !rec.user_preferences.exists?(:email_type => "podwide") mail = single_admin(string, rec)
mail = single_admin(string, rec) mails << mail
mails << mail
end
end end
mails mails
end end

View file

@ -9,8 +9,7 @@ class UserPreference < ActiveRecord::Base
"private_message", "private_message",
"started_sharing", "started_sharing",
"also_commented", "also_commented",
"liked", "liked"]
"podwide"]
def must_be_valid_email_type def must_be_valid_email_type
unless VALID_EMAIL_TYPES.include?(self.email_type) unless VALID_EMAIL_TYPES.include?(self.email_type)

View file

@ -105,10 +105,6 @@
= type.label t('.liked') = type.label t('.liked')
= type.check_box :liked, {:checked => @email_prefs['liked']}, false, true = type.check_box :liked, {:checked => @email_prefs['liked']}, false, true
%br
%p.checkbox_select
= type.label t('.podwide')
= type.check_box :podwide, {:checked => @email_prefs['podwide']}, false, true
%br %br
= f.submit t('.change') = f.submit t('.change')

View file

@ -633,7 +633,6 @@ en:
started_sharing: "...someone starts sharing with you?" started_sharing: "...someone starts sharing with you?"
private_message: "...you receive a private message?" private_message: "...you receive a private message?"
liked: "...someone likes your post?" liked: "...someone likes your post?"
podwide: "...pod-wide news happen [new features, etc.]?"
change: "Change" change: "Change"
destroy: "Account successfully closed." destroy: "Account successfully closed."
getting_started: getting_started:

View file

@ -12,7 +12,6 @@ describe Notifier do
before do before do
Notifier.deliveries = [] Notifier.deliveries = []
end end
describe '.administrative' do describe '.administrative' do
it 'mails a user' do it 'mails a user' do
mails = Notifier.admin("Welcome to bureaucracy!", [user]) mails = Notifier.admin("Welcome to bureaucracy!", [user])
@ -22,7 +21,6 @@ describe Notifier do
mail.body.encoded.should match /Welcome to bureaucracy!/ mail.body.encoded.should match /Welcome to bureaucracy!/
mail.body.encoded.should match /#{user.username}/ mail.body.encoded.should match /#{user.username}/
end end
it 'mails a bunch of users' do it 'mails a bunch of users' do
users = [] users = []
5.times do 5.times do
@ -36,18 +34,6 @@ describe Notifier do
mail.body.encoded.should match /#{this_user.username}/ mail.body.encoded.should match /#{this_user.username}/
} }
end end
it 'does not email the users who opted out of podwide emails' do
users = []
5.times do
users << Factory.create(:user)
end
2.times do |n|
users[n].user_preferences.create(:email_type => 'podwide')
end
mails = Notifier.admin("Welcome to bureaucracy!", users)
mails.length.should == 3
end
end end
describe '.single_admin' do describe '.single_admin' do