Set the common ActionMailer default_url_options only once

There is no need to set options other than the foodcoop during every
change of the scope. This also makes sure that the correct options will
be loaded during testing to fix problems with newer rails versions.
This commit is contained in:
Patrick Gansterer 2019-10-28 21:04:59 +01:00
parent 722bb474d1
commit 91eeac6c40
4 changed files with 10 additions and 3 deletions

View file

@ -71,6 +71,12 @@ class FoodsoftConfig
set_missing
end
def init_mailing
[:protocol, :host, :port, :script_name].each do |k|
ActionMailer::Base.default_url_options[k] = self[k] if self[k]
end
end
# Set config and database connection for specific foodcoop.
#
# Only needed in multi coop mode.
@ -225,9 +231,6 @@ class FoodsoftConfig
end
def setup_mailing
[:protocol, :host, :port, :script_name].each do |k|
ActionMailer::Base.default_url_options[k] = self[k] if self[k]
end
ActionMailer::Base.default_url_options[:foodcoop] = scope
end