FIX: staged users should get emails on must_approve_users sites

This commit is contained in:
Sam 2017-08-28 17:32:07 -04:00
parent 41e7bdff38
commit 50203794e6
2 changed files with 9 additions and 1 deletions

View File

@ -79,7 +79,7 @@ class NotificationEmailer
def perform_enqueue(type, delay) def perform_enqueue(type, delay)
user = notification.user user = notification.user
return unless user.active? || user.staged? return unless user.active? || user.staged?
return if SiteSetting.must_approve_users? && !user.approved? return if SiteSetting.must_approve_users? && !user.approved? && !user.staged?
return unless EMAILABLE_POST_TYPES.include?(post_type) return unless EMAILABLE_POST_TYPES.include?(post_type)

View File

@ -39,6 +39,14 @@ describe NotificationEmailer do
Jobs.expects(:enqueue_in).with(delay, :user_email, NotificationEmailer::EmailUser.notification_params(notification, type)) Jobs.expects(:enqueue_in).with(delay, :user_email, NotificationEmailer::EmailUser.notification_params(notification, type))
NotificationEmailer.process_notification(notification) NotificationEmailer.process_notification(notification)
end end
it "enqueues a job if the user is staged even if site requires user approval" do
SiteSetting.must_approve_users = true
notification.user.staged = true
Jobs.expects(:enqueue_in).with(delay, :user_email, NotificationEmailer::EmailUser.notification_params(notification, type))
NotificationEmailer.process_notification(notification)
end
end end
context "active but unapproved user" do context "active but unapproved user" do