mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 07:43:43 +08:00
c32bd8ae48
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)
26 lines
747 B
Ruby
26 lines
747 B
Ruby
# 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
|