From 9913dfa6c63d7a11789996da83ff3d2d545e9e1c Mon Sep 17 00:00:00 2001
From: Gerhard Schlager <mail@gerhard-schlager.at>
Date: Wed, 18 Mar 2015 20:48:26 +0100
Subject: [PATCH] Imported users shouldn't get an email immediately after the
 import

This sets the last_emailed_at for imported users to now which postpones the sending of digest emails for the configured amount of time. Therefore, the first digest email gets sent after 1 week (the default value of default_digest_email_frequency).
As suggested in https://meta.discourse.org/t/dont-trigger-digests-on-migration/26345/7
---
 script/import_scripts/base.rb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb
index a3120edd24e..eebc0a08c44 100644
--- a/script/import_scripts/base.rb
+++ b/script/import_scripts/base.rb
@@ -293,6 +293,7 @@ class ImportScripts::Base
     opts[:trust_level] = TrustLevel[1] unless opts[:trust_level]
     opts[:active] = opts.fetch(:active, true)
     opts[:import_mode] = true
+    opts[:last_emailed_at] = opts.fetch(:last_emailed_at, Time.now)
 
     u = User.new(opts)
     u.custom_fields["import_id"] = import_id