]> git.openstreetmap.org Git - rails.git/commitdiff
Rename friend to friendship in notifier
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 3 Jun 2020 16:29:08 +0000 (18:29 +0200)
committerAndy Allan <git@gravitystorm.co.uk>
Wed, 3 Jun 2020 16:29:08 +0000 (18:29 +0200)
Followup to #2269

app/controllers/friendships_controller.rb
app/mailers/notifier.rb
app/views/notifier/friend_notification.text.erb [deleted file]
app/views/notifier/friendship_notification.html.erb [moved from app/views/notifier/friend_notification.html.erb with 58% similarity]
app/views/notifier/friendship_notification.text.erb [new file with mode: 0644]
config/locales/en.yml

index 034173e61ea222201676e8ad1348294ce9a8879a..a983bec751442d36a31b26f79b8fca595ad024ea 100644 (file)
@@ -21,7 +21,7 @@ class FriendshipsController < ApplicationController
           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
index 558339889bacf758fc03d8b3edde7aa884091749..3c794cca92f45d376c95ebe4945b150fd713aa22 100644 (file)
@@ -106,16 +106,16 @@ class Notifier < ApplicationMailer
     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
 
diff --git a/app/views/notifier/friend_notification.text.erb b/app/views/notifier/friend_notification.text.erb
deleted file mode 100644 (file)
index e1db966..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<%= 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 -%>
similarity index 58%
rename from app/views/notifier/friend_notification.html.erb
rename to app/views/notifier/friendship_notification.html.erb
index 083f8d3fc8c2ff0a4b140cb490eae4f457adfa36..24587a6e3a42c308a0472efaf9f1389c31b5031f 100644 (file)
@@ -1,9 +1,9 @@
-<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 %>
diff --git a/app/views/notifier/friendship_notification.text.erb b/app/views/notifier/friendship_notification.text.erb
new file mode 100644 (file)
index 0000000..da859d3
--- /dev/null
@@ -0,0 +1,7 @@
+<%= 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 -%>
index 042d998b357e5c4515498e0c8c836384ce936a1b..4f3358989f87b9c334a7d78ea7286613a9a68206 100644 (file)
@@ -1202,7 +1202,7 @@ en:
       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."