flash[:warning] = t "friendships.make_friend.already_a_friend", :name => @new_friend.display_name
elsif friendship.save
flash[:notice] = t "friendships.make_friend.success", :name => @new_friend.display_name
- Notifier.friend_notification(friendship).deliver_later
+ Notifier.friendship_notification(friendship).deliver_later
else
friendship.add_error(t("friendships.make_friend.failed", :name => @new_friend.display_name))
end
end
end
- def friend_notification(friend)
- with_recipient_locale friend.befriendee do
- @friend = friend
- @viewurl = user_url(@friend.befriender)
- @friendurl = make_friend_url(@friend.befriender)
- @author = @friend.befriender.display_name
-
- attach_user_avatar(@friend.befriender)
- mail :to => friend.befriendee.email,
- :subject => I18n.t("notifier.friend_notification.subject", :user => friend.befriender.display_name)
+ def friendship_notification(friendship)
+ with_recipient_locale friendship.befriendee do
+ @friendship = friendship
+ @viewurl = user_url(@friendship.befriender)
+ @friendurl = make_friend_url(@friendship.befriender)
+ @author = @friendship.befriender.display_name
+
+ attach_user_avatar(@friendship.befriender)
+ mail :to => friendship.befriendee.email,
+ :subject => I18n.t("notifier.friendship_notification.subject", :user => friendship.befriender.display_name)
end
end
+++ /dev/null
-<%= t '.had_added_you', :user => @friend.befriender.display_name %>
-
-<%= t '.see_their_profile', :userurl => @viewurl %>
-
-<% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%>
-<%= t '.befriend_them', :befriendurl => @friendurl %>
-<% end -%>
-<p><%= t ".had_added_you", :user => @friend.befriender.display_name %></p>
+<p><%= t ".had_added_you", :user => @friendship.befriender.display_name %></p>
<%= message_body do %>
<p><%= raw t ".see_their_profile", :userurl => link_to(@viewurl, @viewurl) %></p>
- <% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%>
+ <% unless @friendship.befriendee.is_friends_with?(@friendship.befriender) -%>
<p><%= raw t ".befriend_them", :befriendurl => link_to(@friendurl, @friendurl) %></p>
<% end -%>
<% end %>
--- /dev/null
+<%= t '.had_added_you', :user => @friendship.befriender.display_name %>
+
+<%= t '.see_their_profile', :userurl => @viewurl %>
+
+<% unless @friendship.befriendee.is_friends_with?(@friendship.befriender) -%>
+<%= t '.befriend_them', :befriendurl => @friendurl %>
+<% end -%>
hi: "Hi %{to_user},"
header: "%{from_user} has sent you a message through OpenStreetMap with the subject %{subject}:"
footer_html: "You can also read the message at %{readurl} and you can reply at %{replyurl}"
- friend_notification:
+ friendship_notification:
hi: "Hi %{to_user},"
subject: "[OpenStreetMap] %{user} added you as a friend"
had_added_you: "%{user} has added you as a friend on OpenStreetMap."