@readurl = diary_entry_url(comment.diary_entry.user, comment.diary_entry, :anchor => "comment#{comment.id}")
@commenturl = diary_entry_url(comment.diary_entry.user, comment.diary_entry, :anchor => "newcomment")
@replyurl = new_message_url(comment.user, :message => { :title => "Re: #{comment.diary_entry.title}" })
+ @unsubscribeurl = diary_entry_unsubscribe_url(comment.diary_entry.user, comment.diary_entry)
@author = @from_user
attach_user_avatar(comment.user)
:commenturl => link_to(@commenturl, @commenturl) + tag.br,
:replyurl => link_to(@replyurl, @replyurl) %>
</p>
+ <p><%= t ".footer_unsubscribe_html",
+ :unsubscribeurl => link_to(@unsubscribeurl, @unsubscribeurl) %>
+ </p>
<% end %>
==
<%= t '.footer', :readurl => @readurl, :commenturl => @commenturl, :replyurl => @replyurl %>
+
+<%= t '.footer_unsubscribe', :unsubscribeurl => @unsubscribeurl %>
header_html: "%{from_user} has commented on the OpenStreetMap diary entry with the subject %{subject}:"
footer: "You can also read the comment at %{readurl} and you can comment at %{commenturl} or send a message to the author at %{replyurl}"
footer_html: "You can also read the comment at %{readurl} and you can comment at %{commenturl} or send a message to the author at %{replyurl}"
+ footer_unsubscribe: "You can unsubscribe from the discussion at %{unsubscribeurl}"
+ footer_unsubscribe_html: "You can unsubscribe from the discussion at %{unsubscribeurl}"
message_notification:
subject: "[OpenStreetMap] %{message_title}"
hi: "Hi %{to_user},"
assert_match("Jack & Jill <br>", email.text_part.body.to_s)
assert_match("Jack & Jill <br>", email.html_part.body.to_s)
end
+
+ def test_diary_comment_notification
+ create(:language, :code => "en")
+ user = create(:user)
+ other_user = create(:user)
+ diary_entry = create(:diary_entry, :user => user)
+ diary_comment = create(:diary_comment, :diary_entry => diary_entry)
+ email = UserMailer.diary_comment_notification(diary_comment, other_user)
+ body = Rails::Dom::Testing.html_document_fragment.parse(email.html_part.body)
+
+ url = Rails.application.routes.url_helpers.diary_entry_url(user, diary_entry, :host => Settings.server_url, :protocol => Settings.server_protocol)
+ unsubscribe_url = Rails.application.routes.url_helpers.diary_entry_unsubscribe_url(user, diary_entry, :host => Settings.server_url, :protocol => Settings.server_protocol)
+ assert_select body, "a[href^='#{url}']"
+ assert_select body, "a[href='#{unsubscribe_url}']", :count => 1
+ end
end