Commit bd55ad6081281be89bcdc90136c341fe89dce0f6
1 parent
c5265b67
Exists in
master
and in
29 other branches
Set the asset host for person notifier mailing
Showing
2 changed files
with
14 additions
and
0 deletions
Show diff stats
app/models/person_notifier.rb
@@ -74,6 +74,11 @@ class PersonNotifier | @@ -74,6 +74,11 @@ class PersonNotifier | ||
74 | end | 74 | end |
75 | 75 | ||
76 | def content_summary(person, notifications) | 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 | @current_theme = 'default' | 82 | @current_theme = 'default' |
78 | @profile = person | 83 | @profile = person |
79 | @recipient = @profile.nickname || @profile.name | 84 | @recipient = @profile.nickname || @profile.name |
test/unit/person_notifier_test.rb
@@ -225,6 +225,15 @@ class PersonNotifierTest < ActiveSupport::TestCase | @@ -225,6 +225,15 @@ class PersonNotifierTest < ActiveSupport::TestCase | ||
225 | assert !jobs.select {|j| !j.failed? && j.last_error.nil? }.empty? | 225 | assert !jobs.select {|j| !j.failed? && j.last_error.nil? }.empty? |
226 | end | 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 | private | 237 | private |
229 | 238 | ||
230 | def notify | 239 | def notify |