DEV: Improve mbox import script

* Better documentation of settings
* Add option to exclude trimmed parts of emails (enabled by default) to not revail email addresses
This commit is contained in:
Gerhard Schlager
2020-03-13 23:59:14 +01:00
parent 36062f43c8
commit 0a88232e87
4 changed files with 40 additions and 22 deletions

View File

@ -7,9 +7,8 @@ require_relative 'support/settings'
module ImportScripts::Mbox
class Importer < ImportScripts::Base
# @param settings [ImportScripts::Mbox::Settings]
def initialize(settings)
@settings = settings
def initialize(settings_filename)
@settings = Settings.load(settings_filename)
super()
@database = Database.new(@settings.data_dir, @settings.batch_size)
@ -139,7 +138,10 @@ module ImportScripts::Mbox
body = receiver.add_attachments(body, user)
end
body = "#{body}#{Email::Receiver.elided_html(elided)}" if elided.present?
if elided.present? && @settings.show_trimmed_content
body = "#{body}#{Email::Receiver.elided_html(elided)}"
end
body
end