Remove `bounce_score_threshold_deactivate` setting.

Remove bounce_score_threshold_deactivate setting.

Removed bounce_score_threshold_deactivate setting as the deactivate threshold is not getting reached.

diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 543d018c72..59572d9096 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -1893,7 +1893,6 @@ en:
     soft_bounce_score: "Bounce score added to the user when a temporary bounce happens."
     hard_bounce_score: "Bounce score added to the user when a permanent bounce happens."
     bounce_score_threshold: "Max bounce score before we will stop emailing a user."
-    bounce_score_threshold_deactivate: "Max bounce score before we will deactivate a user."
     reset_bounce_score_after_days: "Automatically reset bounce score after X days."
 
     attachment_content_type_blacklist: "List of keywords used to blacklist attachments based on the content type."
@@ -2378,7 +2377,7 @@ en:
   user:
     deactivated: "Was deactivated due to too many bounced emails to '%{email}'."
     deactivated_by_staff: "Deactivated by staff"
-    deactivated_by_inactivity: 
+    deactivated_by_inactivity:
       one: "Automatically deactivated after %{count} day of inactivity"
       other: "Automatically deactivated after %{count} days of inactivity"
     activated_by_staff: "Activated by staff"
diff --git a/config/site_settings.yml b/config/site_settings.yml
index b767833668..01f5439114 100644
--- a/config/site_settings.yml
+++ b/config/site_settings.yml
@@ -1031,7 +1031,6 @@ email:
     client: true
     default: 4
     min: 1
-  bounce_score_threshold_deactivate: 30
   bounce_score_erode_on_send:
     default: 0.1
     hidden: true
diff --git a/lib/email/receiver.rb b/lib/email/receiver.rb
index 81f70f5b4b..d28b0807e7 100644
--- a/lib/email/receiver.rb
+++ b/lib/email/receiver.rb
@@ -266,11 +266,7 @@ module Email
         user.user_stat.reset_bounce_score_after = SiteSetting.reset_bounce_score_after_days.days.from_now
         user.user_stat.save!
 
-        if user.active && range === SiteSetting.bounce_score_threshold_deactivate
-          user.update!(active: false)
-          reason = I18n.t("user.deactivated", email: user.email)
-          StaffActionLogger.new(Discourse.system_user).log_user_deactivate(user, reason)
-        elsif range === SiteSetting.bounce_score_threshold
+        if range === SiteSetting.bounce_score_threshold
           # NOTE: we check bounce_score before sending emails
           # So log we revoked the email...
           reason = I18n.t("user.email.revoked", email: user.email, date: user.user_stat.reset_bounce_score_after)
diff --git a/spec/components/email/receiver_spec.rb b/spec/components/email/receiver_spec.rb
index 6948f47df0..3c31a85872 100644
--- a/spec/components/email/receiver_spec.rb
+++ b/spec/components/email/receiver_spec.rb
@@ -230,22 +230,6 @@ describe Email::Receiver do
 
       expect { process(:hard_bounce_via_verp) }.to raise_error(Email::Receiver::BouncedEmailError)
     end
-
-    it "automatically deactive users once they reach the 'bounce_score_threshold_deactivate' threshold" do
-      expect(user.active).to eq(true)
-
-      user.user_stat.bounce_score = SiteSetting.bounce_score_threshold_deactivate - 1
-      user.user_stat.save!
-
-      expect { process(:soft_bounce_via_verp) }.to raise_error(Email::Receiver::BouncedEmailError)
-
-      user.reload
-      email_log.reload
-
-      expect(email_log.bounced).to eq(true)
-      expect(user.active).to eq(false)
-    end
-
   end
 
   context "reply" do

GitHub sha: 62c21ba6

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/handling-bouncing-e-mails/45343/166