You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2022/06/23 20:52:31 UTC

[whimsy] branch master updated: Show CLAs with no attachments in the workbench

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

sebb 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 3f0f9de6 Show CLAs with no attachments in the workbench
3f0f9de6 is described below

commit 3f0f9de61b4bd9ede3a28b4cb97a02539d0fb9a7
Author: Sebb <se...@apache.org>
AuthorDate: Thu Jun 23 21:52:24 2022 +0100

    Show CLAs with no attachments in the workbench
---
 www/secretary/workbench/models/message.rb | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/www/secretary/workbench/models/message.rb b/www/secretary/workbench/models/message.rb
index 95872469..65262a36 100644
--- a/www/secretary/workbench/models/message.rb
+++ b/www/secretary/workbench/models/message.rb
@@ -13,6 +13,9 @@ class Message
 
   SIG_MIMES = %w(application/pkcs7-signature application/pgp-signature)
 
+  # The name used to represent the raw message as an attachment
+  RAWMESSAGE_ATTACHMENT_NAME = 'rawmessage.txt'
+
   #
   # create a new message
   #
@@ -39,6 +42,10 @@ class Message
       attach.filename == name or attach['Content-ID'].to_s == "<#{name}>"
     end
 
+    if part.nil? and name == RAWMESSAGE_ATTACHMENT_NAME
+      part = self
+    end
+
     if headers
       Attachment.new(self, headers, part)
     end
@@ -52,6 +59,12 @@ class Message
     @mail ||= Mail.new(@raw.gsub(LF_ONLY, CRLF))
   end
 
+  # Allows the entire message to be treated as an attachment
+  # used with RAWMESSAGE_ATTACHMENT_NAME
+  def body
+    @raw
+  end
+
   def raw
     @raw
   end
@@ -434,6 +447,13 @@ class Message
       end
 
       headers[:attachments] = attachments
+    # we also want to treat CLA requests as attachments
+    elsif headers['Subject'].include? 'CLA'
+      headers[:attachments] = [
+        {name: RAWMESSAGE_ATTACHMENT_NAME,
+          length: message.size,
+          mime: 'text/plain'}
+      ]
     end
 
     headers