You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/04/13 02:32:03 UTC

[whimsy] branch master updated: re-implement forward as forward instead of bounce

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git

The following commit(s) were added to refs/heads/master by this push:
       new  ba4e5f5   re-implement forward as forward instead of bounce
ba4e5f5 is described below

commit ba4e5f5036310c112d12c744e9a1df2e2bc2901b
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Apr 12 22:31:16 2017 -0400

    re-implement forward as forward instead of bounce
---
 www/secmail/models/message.rb             |  4 ++++
 www/secmail/views/actions/forward.json.rb | 29 ++++++++++++++++++++++++-----
 www/secmail/views/forms/forward.js.rb     |  6 ++++++
 3 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/www/secmail/models/message.rb b/www/secmail/models/message.rb
index a0e2af1..1c42a50 100644
--- a/www/secmail/models/message.rb
+++ b/www/secmail/models/message.rb
@@ -59,6 +59,10 @@ class Message
     @headers['Message-ID']
   end
 
+  def date
+    mail[:date]
+  end
+
   def from
     mail[:from]
   end
diff --git a/www/secmail/views/actions/forward.json.rb b/www/secmail/views/actions/forward.json.rb
index 467d07b..afdfe2f 100644
--- a/www/secmail/views/actions/forward.json.rb
+++ b/www/secmail/views/actions/forward.json.rb
@@ -1,8 +1,5 @@
 #
-# File an ICLA:
-#  - add files to documents/grants
-#  - add entry to officers/grants.txt
-#  - respond to original email
+# Forward an attachment to another destination
 #
 
 # extract message
@@ -17,8 +14,30 @@ _personalize_email(env.user)
 
 # send confirmation email
 task "email #@email" do
-  mail = Mail.new(message.raw)
+  message = Mailbox.find(@message)
+  text = message.text_part
+
+  # build new message
+  mail = Mail.new
+  mail.subject = 'Fwd: ' + message.subject
   mail.to = @destination
+  mail.from = @from
+
+  # add forwarded text part
+  body = ['-------- Forwarded Message --------']
+  body << "Subject: #{message.subject}"
+  body << "Date: #{message.date}"
+  body << "From: #{message.from}"
+  body << "To: #{message.to}"
+  body << "cc: #{message.cc.map(&:to_s).join(', ')}" unless message.cc.empty?
+  body += ['', text.decoded] if text
+  mail.text_part = body.join("\n")
+
+  # add attachment
+  mail.attachments[@selected] = {
+    mime_type: 'application/pdf',
+    content: message.find(@selected).as_pdf.read
+  }
 
   # echo email
   form do
diff --git a/www/secmail/views/forms/forward.js.rb b/www/secmail/views/forms/forward.js.rb
index f4a4e12..7e68250 100644
--- a/www/secmail/views/forms/forward.js.rb
+++ b/www/secmail/views/forms/forward.js.rb
@@ -36,6 +36,12 @@ class Forward < React
 
       _label do
         _input type: 'radio', name: 'destination',
+          onClick: self.forward, value: 'president@apache.org'
+        _span 'president'
+      end
+
+      _label do
+        _input type: 'radio', name: 'destination',
           onClick: self.forward, value: 'trademarks@apache.org'
         _span 'trademarks'
       end

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].