Skip to content

A platform for community discussion. Free, open, simple.

FIX: don't send activation reminder to staged users

Régis Hanolab79060468aa
diff --git a/app/jobs/scheduled/activation_reminder_emails.rb b/app/jobs/scheduled/activation_reminder_emails.rb
index 8b55100721b..b9f6c2e1935 100644
--- a/app/jobs/scheduled/activation_reminder_emails.rb
+++ b/app/jobs/scheduled/activation_reminder_emails.rb
@@ -4,8 +4,8 @@ module Jobs
def execute(args)
User.joins("LEFT JOIN user_custom_fields ON users.id = user_id AND user_custom_fields.name = 'activation_reminder'")
- .where(active: false, user_custom_fields: { value: nil })
- .where('users.created_at < ?', 2.days.ago)
+ .where(active: false, staged: false, user_custom_fields: { value: nil })
+ .where('users.created_at BETWEEN ? AND ?', 3.days.ago, 2.days.ago)
.find_each do |user|
user.custom_fields['activation_reminder'] = true