attempt to fix the problem where people who wanted emails were no longer getting them
This commit is contained in:
parent
bea1f26c14
commit
51b3cd9c77
2 changed files with 9 additions and 1 deletions
|
|
@ -198,7 +198,7 @@ class User < ActiveRecord::Base
|
|||
######### Mailer #######################
|
||||
def mail(job, *args)
|
||||
pref = job.to_s.gsub('Job::Mail', '').underscore
|
||||
unless self.disable_mail || self.user_preferences.exists?(:email_type => pref)
|
||||
if(self.disable_mail == false && !self.user_preferences.exists?(:email_type => pref))
|
||||
Resque.enqueue(job, *args)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -504,6 +504,14 @@ describe User do
|
|||
Resque.should_not_receive(:enqueue)
|
||||
alice.mail(Job::MailRequestReceived, alice.id, 'contactrequestid')
|
||||
end
|
||||
|
||||
it 'does not send a mail if disable_mail is set to true' do
|
||||
alice.disable_mail = true
|
||||
alice.save
|
||||
alice.reload
|
||||
Resque.should_not_receive(:enqueue)
|
||||
alice.mail(Job::MailRequestReceived, alice.id, 'contactrequestid')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue