diff --git a/app/jobs/scheduled/clean_up_unmatched_emails.rb b/app/jobs/scheduled/clean_up_unmatched_emails.rb new file mode 100644 index 000000000..47cb0d4ba --- /dev/null +++ b/app/jobs/scheduled/clean_up_unmatched_emails.rb @@ -0,0 +1,16 @@ +module Jobs + + class CleanUpUnmatchedEmails < Jobs::Scheduled + every 1.day + + def execute + last_match_threshold = SiteSetting.max_age_unmatched_emails.days.ago + + ScreenedEmail.where(action_type: ScreenedEmail.actions[:block]) + .where("last_match_at < ?", last_match_threshold) + .destroy_all + end + + end + +end diff --git a/app/jobs/scheduled/clean_up_unmatched_ips.rb b/app/jobs/scheduled/clean_up_unmatched_ips.rb new file mode 100644 index 000000000..08de1547c --- /dev/null +++ b/app/jobs/scheduled/clean_up_unmatched_ips.rb @@ -0,0 +1,16 @@ +module Jobs + + class CleanUpUnmatchedIPs < Jobs::Scheduled + every 1.day + + def execute + last_match_threshold = SiteSetting.max_age_unmatched_ips.days.ago + + ScreenedIpAddress.where(action_type: ScreenedIpAddress.actions[:block]) + .where("last_match_at < ?", last_match_threshold) + .destroy_all + end + + end + +end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 1f5b0ef10..e62e3f4d3 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -944,6 +944,9 @@ en: max_new_accounts_per_registration_ip: "If there are already (n) trust level 0 accounts from this IP (and none is a staff member or at TL2 or higher), stop accepting new signups from that IP." min_ban_entries_for_roll_up: "When clicking the Roll up button, will create a new subnet ban entry if there are at least (N) entries." + max_age_unmatched_emails: "Delete unmatched screened email entries after (N) days." + max_age_unmatched_ips: "Delete unmatched screened IP entries after (N) days." + reply_by_email_enabled: "Enable replying to topics via email." reply_by_email_address: "Template for reply by email incoming email address, for example: %{reply_key}@reply.example.com or replies+%{reply_key}@example.com" diff --git a/config/site_settings.yml b/config/site_settings.yml index 6bd32e1d0..b4a106255 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -578,6 +578,8 @@ spam: max: 3 max_new_accounts_per_registration_ip: 3 min_ban_entries_for_roll_up: 5 + max_age_unmatched_emails: 365 + max_age_unmatched_ips: 365 rate_limits: unique_posts_mins: