mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Remove attachments and truncate raw field for incoming emails (#8253)
Adds the settings: raw_email_max_length, raw_rejected_email_max_length, delete_rejected_email_after_days. These settings control retention of the "raw" emails logs. raw_email_max_length ensures that if we get incoming email that is huge we will truncate it removing uploads from the raw log. raw_rejected_email_max_length introduces an even more aggressive truncation for rejected incoming mail. delete_rejected_email_after_days controls how many days we will keep rejected emails for (default 90)
This commit is contained in:
25
spec/tasks/incoming_emails_spec.rb
Normal file
25
spec/tasks/incoming_emails_spec.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe "incoming emails tasks" do
|
||||
before do
|
||||
Rake::Task.clear
|
||||
Discourse::Application.load_tasks
|
||||
end
|
||||
|
||||
describe 'email with attachment' do
|
||||
fab!(:incoming_email) { Fabricate(:incoming_email, raw: email(:attached_txt_file)) }
|
||||
|
||||
it 'updates record' do
|
||||
expect { Rake::Task['incoming_emails:truncate_long'].invoke }.to change { incoming_email.reload.raw }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'short email without attachment' do
|
||||
fab!(:incoming_email) { Fabricate(:incoming_email, raw: email(:html_reply)) }
|
||||
it 'does not update record' do
|
||||
expect { Rake::Task['incoming_emails:truncate_long'].invoke }.not_to change { incoming_email.reload.raw }
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user