]> git.openstreetmap.org Git - rails.git/blobdiff - script/deliver-message
Treat all newly entered blocks of text as Markdown
[rails.git] / script / deliver-message
index 9cce21f30700a881bae47f0b8b28e99cb58f4cf5..6dffea96cbff9633dcc023f9f8a6cc7937c18c2a 100755 (executable)
@@ -18,6 +18,8 @@ end
 
 exit 0 unless recipient[3] == digest[0,6]
 
+message.update_attribute(:message_read, true) if message
+
 mail = Mail.new(STDIN.readlines.join)
 
 if mail.multipart?
@@ -26,10 +28,13 @@ else
   body = mail
 end
 
-message = Message.new(:sender => from, :recipient => to,
-                      :sent_on => mail.date.new_offset(0),
-                      :title => mail.subject.sub(/\[OpenStreetMap\] */, ""),
-                      :body => body.decoded)
+message = Message.new({
+  :sender => from,
+  :recipient => to,
+  :sent_on => mail.date.new_offset(0),
+  :title => mail.subject.sub(/\[OpenStreetMap\] */, ""),
+  :body => body.decoded
+}, :without_protection => true)
 message.save!
 
 Notifier.message_notification(message).deliver