From bd55ad6081281be89bcdc90136c341fe89dce0f6 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 8 Jan 2015 18:21:39 -0300 Subject: [PATCH] Set the asset host for person notifier mailing --- app/models/person_notifier.rb | 5 +++++ test/unit/person_notifier_test.rb | 9 +++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/app/models/person_notifier.rb b/app/models/person_notifier.rb index 84e9fd6..8f6be19 100644 --- a/app/models/person_notifier.rb +++ b/app/models/person_notifier.rb @@ -74,6 +74,11 @@ class PersonNotifier end def content_summary(person, notifications) + if person.environment + ActionMailer::Base.asset_host = person.environment.top_url + ActionMailer::Base.default_url_options[:host] = person.environment.default_hostname + end + @current_theme = 'default' @profile = person @recipient = @profile.nickname || @profile.name diff --git a/test/unit/person_notifier_test.rb b/test/unit/person_notifier_test.rb index 152393d..c862cd3 100644 --- a/test/unit/person_notifier_test.rb +++ b/test/unit/person_notifier_test.rb @@ -225,6 +225,15 @@ class PersonNotifierTest < ActiveSupport::TestCase assert !jobs.select {|j| !j.failed? && j.last_error.nil? }.empty? end + should 'render image tags for both internal and external src' do + @community.add_member(@member) + process_delayed_job_queue + notify + sent = ActionMailer::Base.deliveries.last + assert_match /src="\/\/www.gravatar.com\/avatar.*"/, sent.body.to_s + assert_match /src="http:\/\/.*\/images\/icons-app\/community-icon.png.*"/, sent.body.to_s + end + private def notify -- libgit2 0.21.2