mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: email_always was not respected correctly
In the past email always meant, email me even if active UNLESS I read post Now emails always means, always, even if I read the post
This commit is contained in:
parent
42ce59d257
commit
813fcebdd1
2 changed files with 7 additions and 1 deletions
|
@ -179,7 +179,11 @@ module Jobs
|
|||
return I18n.t('email_log.post_user_deleted') if post.user.blank?
|
||||
return I18n.t('email_log.post_deleted') if post.user_deleted?
|
||||
return I18n.t('email_log.user_suspended') if (user.suspended? && !post.user.try(:staff?))
|
||||
return I18n.t('email_log.already_read') if PostTiming.where(topic_id: post.topic_id, post_number: post.post_number, user_id: user.id).present?
|
||||
|
||||
if !user.user_option.email_always? &&
|
||||
PostTiming.where(topic_id: post.topic_id, post_number: post.post_number, user_id: user.id).present?
|
||||
return I18n.t('email_log.already_read')
|
||||
end
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
|
@ -57,6 +57,8 @@ describe Jobs::UserEmail do
|
|||
it "does send an email to a user that's been recently seen but has email_always set" do
|
||||
user.update_attributes(last_seen_at: 9.minutes.ago)
|
||||
user.user_option.update_attributes(email_always: true)
|
||||
PostTiming.create!(topic_id: post.topic_id, post_number: post.post_number, user_id: user.id, msecs: 100)
|
||||
|
||||
Email::Sender.any_instance.expects(:send)
|
||||
Jobs::UserEmail.new.execute(type: :user_replied, user_id: user.id, post_id: post.id)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue