use fully qualified links in notification email

This commit is contained in:
Skud
2013-03-28 12:18:33 +11:00
parent 7be6ee3d69
commit 1015257cc4
2 changed files with 11 additions and 4 deletions

View File

@@ -3,18 +3,18 @@
%p
You have received a message from
= link_to @notification.sender.login_name, url_for(@notification.sender)
= link_to @notification.sender.login_name, url_for(:controller => 'members', :action => 'show', :id => @notification.sender.id, :only_path => false )
on #{site_name} at #{@notification.created_at.to_s(:date)}
- if @notification.post
in response to
= link_to @notification.post.subject, url_for(@notification.post)
= link_to @notification.post.subject, url_for(:controller => 'posts', :action => 'show', :id => @notification.post.id, :only_path => false)
\.
%blockquote
:markdown
#{strip_tags @notification.body}
%p
= link_to "View this message in your inbox", url_for(@notification)
= link_to "View this message in your inbox", url_for(:controller => 'notifications', :action => 'show', :id => @notification.id, :only_path => false)
%br/
= link_to "Turn off these notifications", edit_member_registration_url

View File

@@ -17,6 +17,13 @@ describe 'notifier/notify.html.haml', :type => "view" do
end
it 'should contain a link to your inbox' do
assert_select "a[href=#{url_for(@notification)}]"
assert_select "a[href*=notifications]"
end
it 'should have fully qualified URLs' do
# lots of lovely fully qualified URLs
assert_select "a[href^=http]", { :minimum => 4 }
# no relative URLs starting with /
assert_select "a[href^=/]", { :count => 0 }
end
end