]> git.openstreetmap.org Git - rails.git/commitdiff
Include an [OpenStreetMap] prefix on the subject of message notifications
authorTom Hughes <tom@compton.nu>
Tue, 29 Jun 2010 08:43:30 +0000 (09:43 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 29 Jun 2010 08:43:30 +0000 (09:43 +0100)
Put back the [OpenStreetMap] prefix to the subject line of email
notifications of messages, but strip it again from any incoming
email replies.

app/models/notifier.rb
config/locales/en.yml
script/deliver-message

index de0ad21d688a1a8fe67e7e6e34479c6c0fedd03e..f63d08b67abc4bda9ea779f2d68633610398573c 100644 (file)
@@ -48,7 +48,7 @@ class Notifier < ActionMailer::Base
   def message_notification(message)
     common_headers message.recipient
     from_header message.sender.display_name, "m", message.id, message.digest
-    subject message.title
+    subject I18n.t('notifier.message_notification.subject_header', :user => message.title, :locale => locale)
     body :to_user => message.recipient.display_name,
          :from_user => message.sender.display_name,
          :body => message.body,
index f79a3d9e5099cc847eb2bb0dbd7d99889f98490d..e3d8803ed28a3d23b88d33b15d3f44f6f6e414cd 100644 (file)
@@ -1062,6 +1062,7 @@ en:
       header: "{{from_user}} has commented on your recent OpenStreetMap diary entry with the subject {{subject}}:"
       footer: "You can also read the comment at {{readurl}} and you can comment at {{commenturl}} or reply at {{replyurl}}"
     message_notification:
+      subject_header: "[OpenStreetMap] {{subject}}"
       hi: "Hi {{to_user}},"
       header: "{{from_user}} has sent you a message through OpenStreetMap with the subject {{subject}}:"
       footer1: "You can also read the message at {{readurl}}"
index 3df09f85fdbde5cf396d55da6591072dfba2b78c..58afa3451af923e042426833bc8d14b7da0ec705 100755 (executable)
@@ -15,6 +15,7 @@ else
   digest = message.digest
   from = message.recipient
   to = message.sender
+  subject = message.subject.sub(/\[OpenStreetMap\] */, "")
 end
 
 exit 0 unless recipient[3] == digest[0,6]
@@ -23,7 +24,7 @@ mail = TMail::Mail.parse(STDIN.readlines.join)
 
 message = Message.new(:sender => from, :recipient => to,
                       :sent_on => Time.now.getutc,
-                      :title => mail.subject,
+                      :title => subject,
                       :body => mail.body)
 message.save!