whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit ca23db8: add a button to request upload of public key
Date Thu, 14 Jan 2016 23:07:22 GMT
Commit ca23db87bfaa3824c4930a7729093a89cae481db:
    add a button to request upload of public key


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
www/secmail/public/secmail.css                               | +++++ 
www/secmail/views/check-signature.js.rb                      | +++++++++ 
www/secmail/views/parts.js.rb                                | ++ -
------------------------------------------------------------
26 changes: 25 additions, 1 deletions.
------------------------------------------------------------


diff --git a/www/secmail/public/secmail.css b/www/secmail/public/secmail.css
index d85f58d..3d3c200 100644
--- a/www/secmail/public/secmail.css
+++ b/www/secmail/public/secmail.css
@@ -71,6 +71,11 @@ form .btn {
   width: 100%
 }
 
+#attachments div.buttons {
+  text-align: center;
+  margin: 1em 0;
+}
+
 .contextMenu {
   position: absolute;
   z-index: 9999999;
diff --git a/www/secmail/views/check-signature.js.rb b/www/secmail/views/check-signature.js.rb
index a2bae6b..fa06849 100644
--- a/www/secmail/views/check-signature.js.rb
+++ b/www/secmail/views/check-signature.js.rb
@@ -11,6 +11,13 @@ def initialize
   def render
     if @signature
       _div.alert @alert, class: @flag
+
+      if @alert.include? 'public key not found'
+        _div.buttons do
+          _button.btn.btn_primary 'email user requesting upload',
+            onClick: self.request_upload
+        end
+      end
     end
   end
 
@@ -71,4 +78,15 @@ def self.find(selected, attachments)
 
     return signature
   end
+
+  # send an email requesting that the user upload their signature
+  def request_upload()
+    destination = @@headers.From
+    subject = "Re: #{@@headers.Subject}"
+    body = "Please upload your public key.\n\nhttps://pgp.mit.edu/"
+
+    window.location = "mailto:#{encodeURIComponent(destination)}" +
+      "?subject=#{encodeURIComponent(subject)}" +
+      "&body=#{encodeURIComponent(body)}"
+  end
 end
diff --git a/www/secmail/views/parts.js.rb b/www/secmail/views/parts.js.rb
index 0207ab5..7171f81 100644
--- a/www/secmail/views/parts.js.rb
+++ b/www/secmail/views/parts.js.rb
@@ -64,7 +64,8 @@ def render
 
     if @selected and not @menu and @selected !~ /\.(asc|sig)$/
 
-      _CheckSignature selected: @selected, attachments: @attachments
+      _CheckSignature selected: @selected, attachments: @attachments,
+        headers: @@headers
 
       # filing options
       _table.doctype do

Mime
View raw message