From 7648916314eb95b61e36a04394ce83d47eaef2f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 25 Jul 2016 17:29:54 +0200 Subject: [PATCH] new 'reset_bounce_score_after_days' site setting --- config/locales/server.en.yml | 1 + config/site_settings.yml | 1 + lib/email/receiver.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index e03c775a9e6..de168d25db7 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -1212,6 +1212,7 @@ en: soft_bounce_score: "Score added to the user when a temporary bounce happens." hard_bounce_score: "Score added to the user when a permanent bounce happens." + reset_bounce_score_after_days: "Automatically reset bounce score after X days." manual_polling_enabled: "Push emails using the API for email replies." pop3_polling_enabled: "Poll via POP3 for email replies." diff --git a/config/site_settings.yml b/config/site_settings.yml index f6dce976f23..26cd4c5af88 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -624,6 +624,7 @@ email: regex: '^key-\h{32}$' soft_bounce_score: 1 hard_bounce_score: 2 + reset_bounce_score_after_days: 30 files: diff --git a/lib/email/receiver.rb b/lib/email/receiver.rb index 7f9f4f5af66..55fffe1b2f9 100644 --- a/lib/email/receiver.rb +++ b/lib/email/receiver.rb @@ -170,7 +170,7 @@ module Email if user = User.find_by(email: email) user.user_stat.bounce_score += score - user.user_stat.reset_bounce_score_after = 30.days.from_now + user.user_stat.reset_bounce_score_after = SiteSetting.reset_bounce_score_after_days.days.from_now user.user_stat.save if user.user_stat.bounce_score >= SiteSetting.bounce_score_threshold