Commit bd55ad6081281be89bcdc90136c341fe89dce0f6

Authored by Victor Costa
1 parent c5265b67

Set the asset host for person notifier mailing

app/models/person_notifier.rb
... ... @@ -74,6 +74,11 @@ class PersonNotifier
74 74 end
75 75  
76 76 def content_summary(person, notifications)
  77 + if person.environment
  78 + ActionMailer::Base.asset_host = person.environment.top_url
  79 + ActionMailer::Base.default_url_options[:host] = person.environment.default_hostname
  80 + end
  81 +
77 82 @current_theme = 'default'
78 83 @profile = person
79 84 @recipient = @profile.nickname || @profile.name
... ...
test/unit/person_notifier_test.rb
... ... @@ -225,6 +225,15 @@ class PersonNotifierTest < ActiveSupport::TestCase
225 225 assert !jobs.select {|j| !j.failed? && j.last_error.nil? }.empty?
226 226 end
227 227  
  228 + should 'render image tags for both internal and external src' do
  229 + @community.add_member(@member)
  230 + process_delayed_job_queue
  231 + notify
  232 + sent = ActionMailer::Base.deliveries.last
  233 + assert_match /src="\/\/www.gravatar.com\/avatar.*"/, sent.body.to_s
  234 + assert_match /src="http:\/\/.*\/images\/icons-app\/community-icon.png.*"/, sent.body.to_s
  235 + end
  236 +
228 237 private
229 238  
230 239 def notify
... ...