]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/notifier.rb
Add explicit primary key declaration for changeset subscriptions
[rails.git] / app / models / notifier.rb
index 8e386edf84bbcfe2baf78f9c3fc58f91608f2b88..8f9e3e2954814e45151632c0ba88ca0db8fa6dfd 100644 (file)
@@ -4,6 +4,7 @@ class Notifier < ActionMailer::Base
           :auto_submitted => "auto-generated"
   helper :application
   before_action :set_shared_template_vars
+  before_action :attach_project_logo
 
   def signup_confirm(user, token)
     with_recipient_locale user do
@@ -166,6 +167,7 @@ class Notifier < ActionMailer::Base
 
   def changeset_comment_notification(comment, recipient)
     with_recipient_locale recipient do
+      @to_user = recipient.display_name
       @changeset_url = changeset_url(comment.changeset, :host => SERVER_URL)
       @comment = comment.body
       @owner = recipient == comment.changeset.user
@@ -191,11 +193,10 @@ class Notifier < ActionMailer::Base
 
   def set_shared_template_vars
     @root_url = root_url(:host => SERVER_URL)
-    attach_project_logo
   end
 
   def attach_project_logo
-    attachments.inline["logo.png"] = File.read("#{Rails.root}/app/assets/images/osm_logo_30.png")
+    attachments.inline["logo.png"] = File.read(Rails.root.join("app", "assets", "images", "osm_logo_30.png"))
   end
 
   def attach_user_avatar(user)
@@ -207,7 +208,7 @@ class Notifier < ActionMailer::Base
     if image && image.file?
       return image.path(:small)
     else
-      return "#{Rails.root}/app/assets/images/users/images/small.png"
+      return Rails.root.join("app", "assets", "images", "users", "images", "small.png")
     end
   end